Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a script to start cmd and run command as admin

Status
Not open for further replies.

winkwire

Systems Engineer
Oct 2, 2018
1
CH
Hi,

I am new to scripting and will need help creating one that will start start a cmd window (as administrator), cd to directory, run a command and close.
This will run for non-admin users as they login so it cannot prompt for admin password. I considered using task scheduler but this is a one time run that will be inserted in the registry runonce key.

example:
start cmd.exe
set tmpdir="C:\Program Files (x86)\camdesk"
cam /resetuserdata
pause
exit

any assistance will be greatly appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top