Reputation: 11
i have make this script in powershell :
$msbuild = "$Env:APPDATA\USBSAVE\usb.exe"
$arguments = " all -w "
start-process $msbuild $arguments
The script works, but the output file (out.txt), appears on the desktop.
How i can to save the output file into $Env:APPDATA\USBSAVE\ ?
Upvotes: 1
Views: 81
Reputation: 4742
Modify your start-process command to include the working directory:
start-process $msbuild $arguments -WorkingDirectory "$Env:APPDATA\USBSAVE\"
Upvotes: 1
Reputation: 46730
I will assume that your console prompt is pointing to your desktop. A simple solution would be to change your directory before calling the process.
$msbuilddir = "$Env:APPDATA\USBSAVE"
Set-Location $msbuilddir
$msbuild = "$msbuilddir\usb.exe"
$arguments = "all -w"
start-process $msbuild $arguments
I would also consider that usb.exe would have switches to define the output. I would look it up but that is more commonly associated to a virus it seems than a utility.
Was also going to mention -WorkingDirectory
as well from Start-Process
but Tony Hinkle beat me to it.
Upvotes: 1