1

I need to start an executable from a parent folder using PowerShell. This is what I have tried:

Start-Process -FilePath ..\Tools\MyTool.exe -ArgumentList "MyArgs" -PassThru -NoNewWindow -Wait

This call fails, because the specified file cannot be found. How must the path to the executable be specified?

PS: It would be great if the actual working directory could remain unchanged.

Boris
  • 8,065
  • 23
  • 61
  • 117

1 Answers1

0

The value for -FilePath parameter needs to be enclosed in quotes (single or double) for the File Explorer to find it properly (assuming that the filepath for the executable actually exists).

You need to execute your cmdlet like this:

Start-Process -FilePath "..\Tools\MyTool.exe" -ArgumentList "MyArgs" -PassThru -NoNewWindow -Wait

And yeah, you definitely don't need to change your actual working directory to do this.

Cheers.

Yash Gupta
  • 1,218
  • 14
  • 21