header1   header
header
header : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
IMPORTANT: PowerShellCommunity.org is moving! - Wednesday, August 15, 2012

PowerShellCommunity.org is moving!  This community software, and the hardware that it sits on, are no longer serving the purposes of this community.  As a result, we have decided to move this community to a new home at PowerShell.org.  PowerShell.org is already up and running with the new community software and in its new location, so please post any new questions that you have on the forums over there instead of posting them on this site.  We've already started getting some great questions from members of the community over there so please, come on over and join us!

While we are going through this transition, this site will remain up for the short term.  New posts may no longer be created on these forums, however replies to existing posts are allowed so that users who posted questions don't have to re-post the same question on the new site.

[UPDATE 28/02/2013] New user registration has been disabled and forums have now been switched to read-only, including for existing posts since all threads that were started should now be completed. If you have a question about content on this site or about PowerShell in general, head over to PowerShell.org and ask it there where there are people actively using the site and answering questions.

If you have any questions, please let us know on the PowerShell.org site.

Thank you,

Kirk "Poshoholic" Munro

 
shell scripting
Last Post 28 Mar 2012 11:49 AM by Russel. 5 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
neatsUser is Offline
New Member
New Member
Posts:4
Avatar

--
28 Mar 2012 10:45 AM
    hello friends, 
    i've been trying to make bat files, with the help of some dos help and some of internet help. i did make some simple scripts easily.
       but i don't know whats wrong with this code, i'm trying to make shutdown script. 
       please assist me.

     here's the code.

      @echo off
    TITLE SHUTTING DOWN THE SYSTEM

    echo What U wish to do..?
    echo 1. shutdown
    echo 2. restart
    echo 3. hibernate
    set /p options= "Options:"

    if "%options%" EQU "1"  goto STDN

    :STDN 
    echo Shutting down...
    shutdown /s /t 30
    echo System will shutdown within less than a minute.
    echo Save all files before shutdown.
    echo Press 1 to abort shutdown.
    :ABRT
    echo aborting.
    ping 1.1.1.1 -w 1000>NUL
    echo aborting....
    ping 1.1.1.1 -w 1000>NUL
    echo aborting.......
    ping 1.1.1.1 -w 1000>NUL
    echo aborting..........
    ping 1.1.1.1 -w 1000>NUL
    echo aborting............
    ping 1.1.1.1 -w 1000>NUL
    shutdown /a

    if "%options%" EQU "2"
    shutdown /r

    if "%options%" EQU "3"
    shutdown /h
    :END

    EBGreenUser is Offline
    Veteran Member
    Veteran Member
    Posts:1276
    Avatar

    --
    28 Mar 2012 10:51 AM
    Well, the first problem with your code is that this is Powershell forum. Powershell is a completely different language than Batch/DOS scripting. the second issue is that you have not explained at all the problem that you are having. How is the script not doing what you want? Is it doing something that you don't want? Are you getting errors? These are all questions that I suggest that you use to post at a Batch forum.
    "Look Ma...no strings!"
    neatsUser is Offline
    New Member
    New Member
    Posts:4
    Avatar

    --
    28 Mar 2012 10:57 AM
    thank you sir.
    EBGreenUser is Offline
    Veteran Member
    Veteran Member
    Posts:1276
    Avatar

    --
    28 Mar 2012 11:00 AM
    You have not even answered the questions that I said would help someone that was willing to take the time to help you.
    "Look Ma...no strings!"
    neatsUser is Offline
    New Member
    New Member
    Posts:4
    Avatar

    --
    28 Mar 2012 11:32 AM
    well while executing the code...
    it won't go further than this messages...
    i.e. from the set command(execution)...

    dos_shell>shutdown.bat
    What U wish to do..?
    1. shutdown
    2. restart
    3. sleep
    Options:1


    and I've to terminate manually by ctrl + c
    RusselUser is Offline
    New Member
    New Member
    Posts:13
    Avatar

    --
    28 Mar 2012 11:49 AM
    Try using the CHOICE command (you need choice.com)
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Many thanks to our original sponsors: Quest Software • SAPIEN Technologies • Compellent • Microsoft footer
    footer   footer