Reputation: 1125
I am trying to run a command in CMD, but would like to run in through PowerShell.
Invoke-Item
opens CMD, but I don't how to pass in program.exe argument > file.txt
Upvotes: 0
Views: 2160
Reputation: 201592
To run cmd.exe from PowerShell, you don't need to use invoke-item e.g.:
cmd /c c:\windows\system32\ipconfig > file.txt
However, why not just run?
ipconfig > file.txt
Upvotes: 1
Reputation: 3572
try passing the command in directly with the full path qualifier of program.exe like:
$test= "c:\windows\system32\program.exe argument > file.txt"
Invoke-Expression $test
Upvotes: 0