Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a powershell script in runonce-Key?

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?

like image 966
Erik Avatar asked Jun 20 '12 12:06

Erik


People also ask

What is the difference between the run and RunOnce keys?

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.


1 Answers

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' " 
like image 176
CB. Avatar answered Oct 16 '22 09:10

CB.