I have a call to powershell.exe that looks like this, and which works from my commandline:
powershell.exe -noexit -command " & 'C:\Test\test.ps1' "
However, when I enter that entry exactly that way in the runonce-key of my current user, nothing happens.
What is the correct way to call powershell.exe passing parameters from runonce or run?
The Run key makes the program run every time the user logs on, while the RunOnce key makes the program run one time, and then the key is deleted. These keys can be set for the user or the machine.
Try with full path:
c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -noexit "C:\Test\test.ps1"
or
c:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command " & 'C:\Test\test.ps1' "
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With