Run a Windows application as the local Admin user, and directly pass a file path to open with that app.
I thought a Windows Command Line script would be the easiest to achieve my challenge. So I tried using…
RUNAS – which runs a specific application under the given name. BUT doesn’t allow to pass a parameter (f.eg. file path)
START – starts an application and let’s you pass a parameter (f.eg. file path). BUT doesn’t allow you to start the application as a different user.
So I continued searching the Internet, and I finally stumbled upon a hint which lead me to the solution: you need to modify a shortcut to the affected application!
In my case I had the issue with the Adobe AIR package- installer and passing directly an Adobe AIR-application to it for install.
Here’s what I did:
- Create a Shortcut to the .EXE-application
- Right-click the Shortcut and select “Properties”
- Move the text-cursor to the very right end of the textfield “Target“, add a space,
…and copy-paste the path of the file you want to pass to the application (the path must be enclosed by double-quotes ” “)
- Now click on “Advanced” in the same window and activate the checkbox “Run with different credentials”
- Execute the modified Shortcut now, enter the desired credentials, and…Tadaa!