Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. param(
  2. [string] $ParamExePath
  3. )
  4.  
  5. function Run-CallThisExe {
  6. param(
  7. [string] $ThisExePath
  8. )
  9.  
  10. Write-Host "ThisExePath: " "$ThisExePath"
  11. start-process -FilePath $ThisExePath
  12. }
  13.  
  14. write-host "ParamExePath: " $ParamExePath
  15.  
  16. Run-CallThisExe -ThisExePath "$ParamExePath"
  17.  
  18. powershell -command .Untitled1.ps1 -NonInteractive -ParamExePath "C:path with spacesmyapp.exe"
  19.  
  20. powershell -command .Untitled1.ps1 -NonInteractive -ParamExePath "C:path with spacesmyapp.exe"
  21.  
  22. powershell -file .Untitled1.ps1 -NonInteractive -ParamExePath "C:path with spacesmyapp.exe"
  23.  
  24. -Command
  25. Executes the specified commands (and any parameters) as though they were
  26. typed at the Windows PowerShell command prompt, and then exits, unless
  27. NoExit is specified. The value of Command can be "-", a string. or a
  28. script block.
  29.  
  30. -File
  31. Runs the specified script in the local scope ("dot-sourced"), so that the
  32. functions and variables that the script creates are available in the
  33. current session. Enter the script file path and any parameters.
  34. File must be the last parameter in the command, because all characters
  35. typed after the File parameter name are interpreted
  36. as the script file path followed by the script parameters.
  37.  
  38. powershell -command .Untitled1.ps1 -NonInteractive "-ParamExePath 'C:path with spacesmyapp.exe'"
  39.  
  40. powershell -command ".Untitled1.ps1 -ParamExePath 'C:path with spacesmyapp.exe'" -NonInteractive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement