It is currently Thu Oct 18, 2018 9:33 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [Solved] Run my exe as admin without prompt?
PostPosted: Wed May 23, 2018 8:49 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1566
[Edit] Solved -- see my post further below.

On Microsoft Windows, how can a user run my exe as an admin, when logged in as a standard user, without getting the UAC prompt every time? And when the PC boots up with my app, the UAC prompt appears for it, which is stupid because the user will be expecting my app to be running after they've made their morning coffee.

I know it can be done with a batch file (I do it that way for "Recuva" by Piriform), but is that the right way to do this? Or do I make a "helper exe" that launches the main exe with admin rights?

Thanks for any advice.


Last edited by Dude on Wed May 23, 2018 10:39 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Run my exe as admin without prompt?
PostPosted: Wed May 23, 2018 9:16 am 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 659
Location: Berlin and Ibiza
It is always with prompt.
But you can register your application as a Windows service, then you always have administrators and system rights without prompt.
UAC is only necessary once when creating the Windows service.

_________________
ImageImageImageImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: Run my exe as admin without prompt?
PostPosted: Wed May 23, 2018 9:36 am 
Offline
User
User

Joined: Wed Apr 18, 2018 8:24 am
Posts: 52
Quote:
I know it can be done with a batch file

If you mean that you create a task via schtasks from that .bat file?
Yeah, that's the correct way to do it


Top
 Profile  
Reply with quote  
 Post subject: Re: Run my exe as admin without prompt?
PostPosted: Wed May 23, 2018 10:18 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1566
@Forumuser: Yes, the batch file looks like this:

Code:
runas.exe /user:Limited-PC\Administrator /savecred Recuva.exe

So the first time I ran that batch file, it asked for my admin name and password, then it remembers it ("save credentials"). Now I just double-click that shortcut to run Recuva without ever getting the annoying UAC prompt.

[Edit] So, I just tried this with my PureBasic exe and it also works, so maybe this is the easy solution? Seems easier than setting up a service (which I have no idea how to do).


Top
 Profile  
Reply with quote  
 Post subject: Re: Run my exe as admin without prompt?
PostPosted: Wed May 23, 2018 10:24 am 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 659
Location: Berlin and Ibiza
That's a possibility, too.
If "save credentials" works, then it is the better solution.

_________________
ImageImageImageImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: Run my exe as admin without prompt?
PostPosted: Wed May 23, 2018 10:38 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1566
SOLVED!

As RSBasic just said, I realized I already had the solution in front of me: build the app as a non-admin exe so anyone can run it, but have that batch file included so people can (edit it once first, and then always) launch it with admin rights and no UAC prompt. Tested and it's working great like that. :)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye