Launch as Admin Powershell via Batch File


So I am running a basic script to copy a shortcut to the public profile desktop so that any user who logs in will have that on their desktop. The circumstances are that I will have to bypass execution policies, so I am doing this via batch file. This is what I have tried but it doesnt seem to work for me…

and the PS file is simply:

When I run it the window just flashes then disappears. If I run it without RunAs I get access denied. I hate to ask this because I’m sure it has been asked before but I am pretty sure I am executing this correctly. Thoughts?


Like a few others have said, this isn’t the best choice for delivering shortcuts.

That being said, there are two issues. One is needing a - at execution policy. The other is after the elevated powershell instance is created the working path changes. So you need to add the full path to the script, which you can do with %~dp0 if it’s a batch file.

Same likely needs to be done with the powershell script afterwards.

This assumes the batch file, the short cut, and the powershell script are all in the same folder.


Launch as Admin Powershell via Batch File by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply