+ Post New Thread
Results 1 to 10 of 10
Windows Thread, Shutdown.bat in Technical; I was wondering if anyone can explain this error - I've just put in a scheduled task to Shutdown all ...
  1. #1
    Mr.Ben's Avatar
    Join Date
    Jan 2008
    Location
    A Pirate Ship
    Posts
    941
    Thank Post
    182
    Thanked 157 Times in 126 Posts
    Blog Entries
    2
    Rep Power
    65

    Shutdown.bat

    I was wondering if anyone can explain this error -

    I've just put in a scheduled task to Shutdown all of the PC's (a pupil used to do it to 'help' me but the campus size is too big now).

    It's only a batch file, using the Shutdown machine to warn users for 20 mins then turn off the pc's.

    If the batch file is called 'shutdown.bat' then it doesn't execute properly, instead going round in circles on the first machine in the list.

    If it's called 'TurnOff.bat' then the same file works perfectly!

    Just wondering if anyone has an explaination!

  2. #2

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    It probably references itself. Can you post the contents?

    Alternatively, Shutdownertron will do the job for you, no scripts involved.

  3. Thanks to powdarrmonkey from:

    Mr.Ben (6th May 2009)

  4. #3
    Mr.Ben's Avatar
    Join Date
    Jan 2008
    Location
    A Pirate Ship
    Posts
    941
    Thank Post
    182
    Thanked 157 Times in 126 Posts
    Blog Entries
    2
    Rep Power
    65
    Hi powdarrmonkey,

    All it is is line after line of the following (with different machine names).

    I can't use IP addresses as I have a very short lease set (due to not having enough IP's, but thats on its way to being fixed) and we have a residential part of the school, so I can't turn off those PC's at 18:00!

    shutdown -f -t 1200 -m \\FWS-ADM-100 -c "This is the nightly Shutdown for all PC's."

  5. #4
    monkeyx's Avatar
    Join Date
    Nov 2006
    Posts
    364
    Thank Post
    8
    Thanked 52 Times in 41 Posts
    Rep Power
    25
    Hi you could also look at a script I wrote that uses machine names from Active Directory. This script uses vbs does not need a client and can allow users to opt out via a GPO option. It also logs process to a file. You may be able to change script so it use a simple array of names if you do not want to link with AD structure.

    Documentation and script can be found here.

  6. Thanks to monkeyx from:

    Mr.Ben (6th May 2009)

  7. #5

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,843
    Thank Post
    876
    Thanked 1,679 Times in 1,459 Posts
    Blog Entries
    12
    Rep Power
    444
    Quote Originally Posted by powdarrmonkey View Post
    It probably references itself. Can you post the contents?

    Alternatively, Shutdownertron will do the job for you, no scripts involved.
    I love this software, give it a go its excellent.

  8. Thanks to FN-GM from:

    Mr.Ben (6th May 2009)

  9. #6
    Mr.Ben's Avatar
    Join Date
    Jan 2008
    Location
    A Pirate Ship
    Posts
    941
    Thank Post
    182
    Thanked 157 Times in 126 Posts
    Blog Entries
    2
    Rep Power
    65
    I'll give it a go, looks an awful lot tidier than batch files and the like!

  10. #7

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,403
    Thank Post
    637
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    319
    There's a conflict between Shutdown.exe (the program you want to call) and Shutdown.bat (when ran) - as you only call 'shutdown'. Either use the full path to shutdown.exe, or rename the batch file

  11. Thanks to webman from:

    Mr.Ben (6th May 2009)

  12. #8

    Join Date
    Feb 2006
    Location
    Derbyshire
    Posts
    1,381
    Thank Post
    181
    Thanked 211 Times in 171 Posts
    Rep Power
    65
    Quote Originally Posted by Mr. Ben View Post
    Hi powdarrmonkey,

    All it is is line after line of the following (with different machine names).

    I can't use IP addresses as I have a very short lease set (due to not having enough IP's, but thats on its way to being fixed) and we have a residential part of the school, so I can't turn off those PC's at 18:00!

    shutdown -f -t 1200 -m \\FWS-ADM-100 -c "This is the nightly Shutdown for all PC's."
    If you save the file as shutdown.bat, the first path searched for shutdown will be the local directory and will just rerun the batch file - which will rerun the batch file - which will... etc. Changing the line to

    shutdown.exe -f -t 1200 -m \\FWS-ADM-100 -c "This is the nightly Shutdown for all PC's."

    should fix it as it will now explicitly be looking for the exe file, not the bat.

    Edit : Doh. Longer answer beaten by quick one!

  13. Thanks to OutToLunch from:

    Mr.Ben (6th May 2009)

  14. #9
    Mr.Ben's Avatar
    Join Date
    Jan 2008
    Location
    A Pirate Ship
    Posts
    941
    Thank Post
    182
    Thanked 157 Times in 126 Posts
    Blog Entries
    2
    Rep Power
    65
    Makes sense guys, cheers

  15. #10
    Mr.Ben's Avatar
    Join Date
    Jan 2008
    Location
    A Pirate Ship
    Posts
    941
    Thank Post
    182
    Thanked 157 Times in 126 Posts
    Blog Entries
    2
    Rep Power
    65
    Gave up with the script. Shutdownertron was so much easier!

  16. Thanks to Mr.Ben from:

    powdarrmonkey (8th May 2009)

SHARE:
+ Post New Thread

Similar Threads

  1. SIMSPERM.bat
    By cookie_monster in forum MIS Systems
    Replies: 13
    Last Post: 14th May 2014, 02:02 PM
  2. BAT & VBS
    By Chuckster in forum Windows
    Replies: 7
    Last Post: 30th April 2009, 12:15 PM
  3. The Bat
    By Dos_Box in forum General Chat
    Replies: 1
    Last Post: 11th July 2008, 01:19 PM
  4. simsperm.bat
    By robert.mabbutt in forum MIS Systems
    Replies: 9
    Last Post: 15th August 2007, 09:43 PM
  5. bat versus vbs
    By Uraken in forum Scripts
    Replies: 8
    Last Post: 30th January 2007, 10:41 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •