Run as Administrator in batch file

Microsoft Windows 7 professional 64-bit
June 22, 2010 at 06:50:09
Specs: Windows 7 64-bit
Hello All,
I need to create a virtual drive in an NT batch
file to install my apps to this particular drive.
To obtain write access, I have to right-click the
Command Console as select "Run as
Administrator" to gain R/W access. I need to
run the following command with full admin
rights from a script but don't know how:
subst Q: c:\

How do I run this from the script with priveliged
access instead of having to manually "Run as
Administrator" first? I'm familiar with the Run As command but would like to do this with out being prompted for a password. I have admin rights already on this machine. Thanks for any help you
can provide.

See More: Run as Administrator in batch file

Report •

June 22, 2010 at 08:17:07
I'm not a security guy, but if you have admin rights, doesn't that
already negate the need to use "Run As"? I'm also back leveled
running XP, so it may be my ignorance of Win7.

Sorry for the "not an answer" response...

Insomniac at large

Report •

June 22, 2010 at 08:26:05
In Vista and Win7 you now have the UAC which changes the
way administrator privileges work. You now get prompted to
elevate privileges to run as an administrator.

Report •

June 22, 2010 at 13:33:28
An EXE can request elevation; a script cannot.

If your script language has access to COM objects, you can use Shell.Application's ShellExecute method to get Explorer to run it as an Administrator (after the proper UAC elevation dialog).

Report •

Related Solutions

June 24, 2010 at 05:09:55
Hi pqhanna,

So if I did understand you want execute some commands with admin rights?

Try to open command prompt with admin rights, then execute commands?

Start --> Run --> CMD --> runas/user:administrator cmd.exe
Type the password for administrator:
Confirm the password:

Here will be another command prompt opened, that is runned as admin, you can see that in the titlebar too.

Now type your commands..

Kind Regards,


Report •

September 7, 2010 at 12:14:33
thanks pq

that worked perfectly for me!. i was trying everything under the sun .dsa.compmgnt...etc. nothing worked.

duh...and how simple a fix to run a batch file with rights. now i get to go to all the desktops and run my batch file without logging them off. no more email surfing....



Report •

Ask Question