I have a set of Powershell commands that I need to run every hour. Some retrieve data, then I want to run a parser I wrote in C++, and Ill want to export the output from that to another location.
The problem is that the parser doesnt write its output file when called through PS. I can see that it runs, but no files are generated by. It does work fine when just manually run through windows or cmd.
Does anyone know why that is? Ive tried both of these commands:
powershell.exe -command "& {$exePath = Join-Path -Path 'C:....\data' -ChildPath ('\abcd_{0:MM-dd-HH}\Parser.exe' -f (Get-Date));$client = Start-Process -FilePath $exePath -wait}"
and
powershell.exe -Command Start-Process -FilePath "C:...\data\abcd$(Get-Date -f MM-dd-HH)\Parser.exe" -wait -passthru
Where C:...\ and abcd are just placeholders for the actual path and filename that I use. Both these lines run the parser but neither allows it to create output.
Im running all the commands from a .bat that I run through Task Scheduler. I know thats suboptimal and Ill look into other ways like a .ps1 etc, but when I run it from within Powershell itself they also dont work. If that will be the deciding factor I can move away from the .bat but Id first like to find a way to make it work at all.