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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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?
Edward PamiasTeam Lead RRS DeskAuthor Commented:
I am just clicking on the file within windows explorer
Chris MillardCommented:
Can you right click on the batch file, select properties and set the runas in there?
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Edward PamiasTeam Lead RRS DeskAuthor Commented:
No, it does not give me an option for that under properties.
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.
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.
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?
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...
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

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.
Edward PamiasTeam Lead RRS DeskAuthor Commented:
Thanks for the help.
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.