Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
How to "Start Application" as Administrator?
How to "Start Application" as Administrator?
Is there a way for "Start Application" to launch the target program with administrative privileges? I have a short batch script saved as a .cmd file. It does not work correctly when launched by Start Application. I've also found that it is unsuccessful when run from a standard CLI session, but works correctly when run from a CLI started with "Run as Administrator". The only command being used is devcon.exe (enable and disable). Can someone help? Thanks.
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: How to "Start Application" as Administrator?
It is strange that no one answered you.
It's so easy:
1. Here you download PsTools by Mark Russinovich
2. The downloaded file unzip and the file psexec.exe put to the directory where you have EventGhost installed
3. Into your macro insert Python script action with this code4. Instead of notepad.exe enter the path to your exe file
5. Of course, you also need to replace the strings <USER> and <PASSWORD>
Pako
It's so easy:
1. Here you download PsTools by Mark Russinovich
2. The downloaded file unzip and the file psexec.exe put to the directory where you have EventGhost installed
3. Into your macro insert Python script action with this code
Code: Select all
appPath = 'notepad.exe'
from subprocess import Popen, SW_HIDE
args = ['psexec.exe','-u','<USER>','-p','<PASSWORD>']
args.append(appPath)
Popen(args, creationflags = SW_HIDE, shell = True)5. Of course, you also need to replace the strings <USER> and <PASSWORD>
Pako
Re: How to "Start Application" as Administrator?
Pako, thanks very much for taking the time to detail how to do this. Your example appears to work. Easy? Only for someone with superior knowledge!
Re: How to "Start Application" as Administrator?
Hi.
I have the same problem after changing vom Windows 7 to Windows 8.1
Can it be that the script only works for programs (*.exe) but not for Batch Scripts (*.cmd)?
Siutsch.
I have the same problem after changing vom Windows 7 to Windows 8.1
Can it be that the script only works for programs (*.exe) but not for Batch Scripts (*.cmd)?
Siutsch.
Re: How to "Start Application" as Administrator?
You can try creating a Task with admin privileges and then create a shortcut to start the task.
schtasks.exe /run /tn "task"
schtasks.exe /run /tn "task"
Re: How to "Start Application" as Administrator?
A belated thank you very much. I just tried your solution and it works great.bskchaos wrote:You can try creating a Task with admin privileges and then create a shortcut to start the task.
schtasks.exe /run /tn "task"