Open multiple command windows with admin ID

All,

I need to modify this batch file to open the cmd.exe with runas or since I am running this on my own PC I can have my ID and password in the file. The file works fine as is but since all my admin access is in another account I have to do a runas for anything to work.

@echo off
setlocal
for /l %%i in (1, 1, 32) do (
      start "Shutdown nyp%%i.txt" cmd.exe /c psshutdown.exe @nyp%%i.txt -s -f -t 0
LVL 19
Edward PamiasTeam Lead RRS DeskAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris MillardCommented:
How are you calling the batch file at the moment?
0
Edward PamiasTeam Lead RRS DeskAuthor Commented:
I am just clicking on the file within windows explorer
0
Chris MillardCommented:
Can you right click on the batch file, select properties and set the runas in there?
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Edward PamiasTeam Lead RRS DeskAuthor Commented:
No, it does not give me an option for that under properties.
0
Chris MillardCommented:
OK - create a shortcut to the batch file. Then right-click the shortcut and select properties. Then choose the Shortcut tab, and the advanced button. In there you can choose to Run As Administrator.
0
Chris MillardCommented:
There's also an article at http://www.howtogeek.com/howto/windows-vista/create-administrator-mode-shortcuts-without-uac-prompts-in-windows-vista/ that shows how to create shortcuts to run batch files with administrative rights that might be of use.
0
Edward PamiasTeam Lead RRS DeskAuthor Commented:
All I need to know if I right click on this cmd file and run as an admin user will all the command windows it open have the same rights?
0
Chris MillardCommented:
Of course, another option is to use PSEXEC from PSTOOLS (https://technet.microsoft.com/en-gb/sysinternals/bb896649.aspx)

You can use PsExec to run files under specific credentials...
0
Lionel MMSmall Business IT ConsultantCommented:
All I need to know if I right click on this cmd file and run as an admin user will all the command windows it open have the same rights?  The answer is yes
You can run this as a scheduled task and set the user and password there because having your username and pw in a script is not a good idea
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Edward PamiasTeam Lead RRS DeskAuthor Commented:
Thanks for the assist folks. I figured this out at 8pm last night when I had to run my cmd file.
0
Edward PamiasTeam Lead RRS DeskAuthor Commented:
Thanks for the help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.