How can I execute an external program with parameters in PowerShell?

If you want to run a program, just type its name and parameters:

notepad.exe C:\devmy\hi.txt

If you want to run an exe and redirect stdin to it which your example seems to be an attempt of, use:

Get-Content c:devmy\hi.txt | yourexe.exe 

If you need to specify the full path to the program then you need to use ampersand and quotes otherwise powershell thinks you are defining a plain string:

&"C:\Program Files (x86)\Notepad++\notepad++.exe"

Leave a Comment