Batch File creation: Help Needed

Posted on 2008-11-11
Last Modified: 2013-11-10
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

Question by:SOSTechteam
    LVL 63

    Accepted Solution

    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 !
    LVL 23

    Assisted Solution

    by:Malli Boppe
    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.

    Author Comment

    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?
    LVL 23

    Assisted Solution

    by:Malli Boppe
    Are they running it on the local machine or through terminal services.
    What error do they get.

    Author Comment

    Found a solution: using runasscp to execute the shutdown command has worked beautifully.

    Author Closing Comment

    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.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    scoresClump  challenge 31 87
    wordsWithout 49 64
    mapAB Challlenge 35 54
    groovy example issue 10 34
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now