|
It is currently Tue Jun 18, 2013 7:59 pm
|
Register for Windows Forums
 |
Register
Register for Windows Forums now to gain access to: post messages, download free books, competitions for great prizes, and get to know others. Members also see NO ADVERTS. Join today!
|
 |
|
 |
|
| Message |
Author |
 |
Post subject: Start batch file as administrator?   Posted: Wed Oct 05, 2011 6:56 pm |
Stu
|
I'm writing a(nother) script that when an image is dropped onto, it sets said image as the login screen background for Windows 7. When UAC is off/ in Admin account, the image (which is defined as %1 in the batch file) is copied to system32 and some reg values are changed. When i start as a regular user or on a machine with UAC on, i get access denied messages (obviously), there doesn't seem to be anyway to elevate the script. Any ideas out there guys? Example: @echo off copy /y %1 %windir%\system32\blah.jpg regedit.exe blah blah
TIA
_________________
|
|
Joined: Sat Jun 07, 2008 9:08 am Posts: 3186 Thanks given: 375 times Thanks received: 441 times Location: 0x7C00
OS: 8 RT
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 12:51 am |
UVAIS
|
|
Try Right Click 'Run as Admin" LOL
Edit : I think you are trying to something like changing 7's Start up wall from .bat file ? Am i Right ?
_________________
|
|
Joined: Sat Aug 21, 2010 2:08 pm Posts: 1499 Thanks given: 121 times Thanks received: 262 times Location: UVAIS-PC
OS: 7 Ultimate
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 3:21 pm |
Stu
|
UVAIS wrote: I think you are trying to something like changing 7's Start up wall from .bat file ? Am i Right ? Yes. As per my initial post i am trying to change the login screen. UVAIS wrote: Try Right Click 'Run as Admin" LOL Thanks for the suggestion. That'd work if there was no argument (ie the image file).
_________________
|
|
Joined: Sat Jun 07, 2008 9:08 am Posts: 3186 Thanks given: 375 times Thanks received: 441 times Location: 0x7C00
OS: 8 RT
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 5:12 pm |
Makcalable
|
|
Well this sort of stuff is beyond me but I was kinda wondering about what Uvais said..... does your admin username not need to added in the batch file?
If I am talking mince just tell me LOL
_________________
|
|
Joined: Mon Nov 15, 2010 7:20 pm Posts: 565 Thanks given: 47 times Thanks received: 132 times Location: UK
OS: 8 RT
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 6:33 pm |
Stu
|
|
Right clicking the batch file and running as admin or making a shortcut and setting it to always run as admin will work so long as the batch file is run directly (double clicked), if we invoke the batch file via an image being dropped onto it we have no way (yet) to elevate so both methods are useless in this case.
You could use the runas /user:administrator but that means that the built-in hidden Admin account has to have a password set and is enabled. Also if this is done, i have to invoke another command prompt window as the runas command requires a program to run (ie runas /user:administrator notepad.exe) so we have ourselves a loop.
_________________
|
|
Joined: Sat Jun 07, 2008 9:08 am Posts: 3186 Thanks given: 375 times Thanks received: 441 times Location: 0x7C00
OS: 8 RT
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 6:41 pm |
Makcalable
|
Well if you wanted to post this on my forum as there are many guys over there deal in all this sort of stuff and may be able to shed some light on it for you. either way no harm done
_________________
|
|
Joined: Mon Nov 15, 2010 7:20 pm Posts: 565 Thanks given: 47 times Thanks received: 132 times Location: UK
OS: 8 RT
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 6:43 pm |
Stu
|
Makcalable wrote: Well if you wanted to post this on my forum as there are many guys over there deal in all this sort of stuff and may be able to shed some light on it for you. either way no harm done  I don't have an account to post. You could link back to this post if you like? I was literally just looking through your programming forum!!!
_________________
|
|
Joined: Sat Jun 07, 2008 9:08 am Posts: 3186 Thanks given: 375 times Thanks received: 441 times Location: 0x7C00
OS: 8 RT
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 6:53 pm |
Makcalable
|
|
Ok I have been told that you cannot do this using DOS you will need to use Visual Basic instead....
I will repost the question over there for you and see what comes back
_________________
|
|
Joined: Mon Nov 15, 2010 7:20 pm Posts: 565 Thanks given: 47 times Thanks received: 132 times Location: UK
OS: 8 RT
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 6:57 pm |
Stu
|
It can be done without Visual Basic, whoever told you that is telling porky pies!  + the fact i don't know VB! (neither am i using DOS) Seen the post over on your, thanks for that
_________________
|
|
Joined: Sat Jun 07, 2008 9:08 am Posts: 3186 Thanks given: 375 times Thanks received: 441 times Location: 0x7C00
OS: 8 RT
|
|
|
|
 |
| |
Post subject: Re: Start batch file as administrator?  Posted: Thu Oct 06, 2011 7:21 pm |
Makcalable
|
|
LOL sure thing, I am sure it will attract plenty of attention over the next couple of days and we have a good bunch of young guys who are well into this type of stuff so fingers crossed.
_________________
|
|
Joined: Mon Nov 15, 2010 7:20 pm Posts: 565 Thanks given: 47 times Thanks received: 132 times Location: UK
OS: 8 RT
|
|
|
|
 |
|
|
 |
|
 |
|
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 You cannot post attachments in this forum
|
|