Batch File creation: Help Needed

I need some assistance in the creation of a batch file.


1. Batch file is run and the first thing it does is run a vbscript located in the same folder.
2. Once the vbscript is finished, the batch file restarts the machine.

I have a notion it has something to do with the exit code as to why my current script is not continuing after the .vbs has ran.  If I was not clear in any way forgive me, just ask and I will be glad to answer and additional questions you may have.

@Echo Off
cscript script.vbs
shutdown -r -c "Custom Message" -t 120

Open in new window

Who is Participating?

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

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.

call cscript script.vbs

Otherwise the script may simply not ever reach the next line

alternatively use the shell command in your VBscript to do the shutdown.
I hope this helps !

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
Malli BoppeCommented:
The scriot works fine I have tested with a sample VB script.
It could be the problem with your VBscript which doesn't exit properly.
SOSTechteamAuthor Commented:
Thanks for the replies, I should have mentioned this, since I believe it is where the issue lies.

The users running the batch are not administrators, so they are unable to execute the 'shutdown' command.

Which leads me to a great question how can I get the batch file to run the shutdown command as administrator without having the password entered each time the batch is ran?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Malli BoppeCommented:
Are they running it on the local machine or through terminal services.
What error do they get.
SOSTechteamAuthor Commented:
Found a solution: using runasscp to execute the shutdown command has worked beautifully.
SOSTechteamAuthor Commented:
I was on the right track, but the admin rights is what was hanging me up.  Runasscp solved this issue and everything is gravy now.
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

From novice to tech pro — start learning today.