nsExec::ExecToStack 'powershell -NoProfile -Command "$(& {$Args[0]})" "where code"'
Pop $0 ;
${NSD_SetText} $LocationTextbox "$0"
When running this I'm getting 0 as the output. Am I missing something here ?
nsExec::ExecToStack 'powershell -NoProfile -Command "$(& {$Args[0]})" "where code"'
Pop $0 ;
${NSD_SetText} $LocationTextbox "$0"
When running this I'm getting 0 as the output. Am I missing something here ?
Copyright © 2021 Jogjafile Inc.
I dont think
nsExec::ExecToStackis behaving the way your expecting. Taken from the docs:So the value 0 means "Success" - ie the powershell process started and returned a success code of 0.
Looking at the 3rd example from the ExecToStack docs, it seems stdout is next on the stack:
$StdOutText will include everything outputted by Powershell (you might want to add
/nologoto your powershell command to remove some of the garbage) - so that might be an option depending on what your script does.Another option would be to write the value to a file from Powershell with
Set-Content, then read from that file withFileOpen/FileRead/FileClosein NSIS.