title: Powershell start notepad.exe and a command windows starts and disappears
body: <p>I have a script to start another ps1 script as aspecific user that does a simple dir on a directory and it works, when it runs a separate cmd window appears with the directory contents.  </p>
  
  <pre><code>$encpwd = Get-Content C:\path\to\creds.txt
  
  $passwd = ConvertTo-SecureString $encpwd
  
  $cred = new-object System.Management.Automation.PSCredential 'theuser',$passwd
  
  Start-Process c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -Credential $cred  -ArgumentList '-noexit','-File', 'C:\path\to\script\test.ps1'
  </code></pre>
  
  <p>My goal is to start an application as a specific user.  So first I wanted to test with notepad.exe  So I changed the last line to: </p>
  
  <pre><code>Start-Process c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -Credential $cred  -ArgumentList '-noexit','-File', 'C:\windows\system32\notepad.exe'
  </code></pre>
  
  <p>All I get is a command window that quickly disappears, can't tell if there is an error etc.  I also tried calling a ps1 script that invoked notepad and got the same result, even though on its own the the new script invoked notepad just fine.</p>
  
  <p>Can someone explain where I am going wrong, Thanks</p>