There’s a decent reference at https://ss64.com/nt/syntax-esc.html , but the short answer is to wrap all of the cmd.exe parameters in an additional set of doublequotes. Note this is a cmd.exe thing, not a bigfix thing, so other programs don’t handle quoted command lines the same way.
/tmp/mount_new_nas.sh > /tmp/bftask_.log
because “>” doesnt work in the action. It never worked for me.
so i have put that statement in another script.
The method of using a createfile to run the script and handle redirecting output works well, is cross-platform, and works with all commands so I do like that method.
Using the quote-wrapping method I described does work specifically in the case of using cmd.exe though. The fact you got an empty file implies redirection is working, but there was no stdout output. Perhaps you got an error to stderr instead. Try
waithidden cmd.exe /C ““C:\Windows\System32\cscript.exe” /B “C:\Program Files\Microsoft Office\Office16\ospp.vbs” /dstatus > C:\ospp_vbs_dstatus.txt 2>&1"
To show the error output as well.
If you’re gonna use powershell, use Start-Transcript -Force c:\yourpath.txt and Stop-Transcript. I use that quite a bit for action troubleshooting. An example:
// Disable wow64 redirection on x64 OSes
action uses wow64 redirection {not x64 of operating system}
waithidden { pathname of file ((it as string) of value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of native registry) } -ExecutionPolicy Bypass -File powershell.ps1
That’s just a generic powershell template I got from another user on this forum; you can wrap w/e in it.