title: Dynamic path in Powershell workflow
body: <p>I'm trying to use a variable to specify a path in a Powershell workflow, more specifically in a <code>InlineScript</code> of a Workflow.</p>
  
  <p>To add more context: I'm writing a deployment script for my application. I need to restart the computer and continue my script. I achieved this part by registering a Scheduled task which is launching another script at startup.</p>
  
  <p>So I have a first script A which registers some jobs like:</p>
  
  <pre><code>workflow installXming{
      Suspend-Workflow
      InlineScript{
          $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
          Import-Module "$scriptPath\modules\_install_Xming_fonts.ps1";
          xming_fonts
      }
  }
  </code></pre>
  
  <p>This script reboot the computer and call a second script B which resumes the suspended jobs:</p>
  
  <pre><code>$jobs = Get-Job -state Suspended
  $resumedJobs = $jobs | resume-job -wait
  $resumedJobs | wait-job
  </code></pre>
  
  <p>When I get the output of my job, I got an error on my <code>$scriptPath</code> variable.</p>
  
  <p>I know I can't use the <code>$PSScriptRoot</code> in a Powershell workflow. </p>
  
  <p>Is there any way I can use "persitent" variable to store some value or is there a way to use a variable to store the path of my script ? </p>