Results 1 to 4 of 4

Thread: Creating Vista Shutdown.bat file

  1. #1
    Join Date
    Feb 2009
    Posts
    29

    Creating Vista Shutdown.bat file

    Hello , Can you Tell Is It Possible to make one of these Batch for Windows vista? I need one to shutdown my PC Quickly Like We Do Use to do in Windows Xp once , Although I Tried Same windows Xp Shutdown code but it Does not Work for Windows Vista Thanks in Advance

  2. #2
    Dr. V Guest

    Re: Creating Vista Shutdown.bat file

    You could also create a batch file named something fairly unique like xShutdown.bat and save it in your Start Menu>Programs folder. Edit it and enter the text "shutdown /s /t 0" (w/o the quotes) and save it. Now, you can use the keyboard shortcut win + x + s + enter to let Vista's start menu search find the batch file and run the shutdown command.

    Similarly, use "shutdown /r /t 0" for rebooting and "shutdown /h" for hibernation.

    Note: Use a prefix like "x" or "q" on your batch files so the start menu search will locate and isolate them quickly with minimal keystrokes.

  3. #3
    Join Date
    Nov 2005
    Posts
    1,203

    Re: Creating Vista Shutdown.bat file

    Right click on your desktop and select new > shortcut. In dialog box type “shutdown –s”, click next to continue and then type a name for shortcut and click finish.

    You can add below parameters:

    shutdown [{-l|-s|-r|-a}] [-f] [-m [\\ComputerName]]

    -l >> Logs off the current user
    -s >> Shuts down the local computer
    -r >> Reboots after shutdown
    -a >> Aborts shutdown. Ignores other parameters, except -l and Computer Name
    -f >> Forces running applications to close.
    -m [\\ComputerName] >> computer name

    To create a suspend icon, type “rundll32.exe PowrProf.dll, SetSuspendState”

  4. #4
    Join Date
    Mar 2011
    Posts
    1

    Re: Creating Vista Shutdown.bat file

    I have been looking around the internet for quite some time, and have not found a complete solution for my needs on Windows Vista.

    I did however find enough information to create my own batch file with some help from google and great people that share info online, so now I want to share with the internet, because there might be more people wanting this.

    The code is as follows:

    @echo off
    title Vista batch timer.
    color A
    cls
    @Echo --------------------------------------------------------------------
    @Echo Dette program kan slukke computeren, 1 til 4 timer fra nu af.
    @Echo --------------------------------------------------------------------

    set h=%TIME:~0,2%
    set m=%TIME:~3,2%
    set dato=%DATE%

    SET /P ANSWER=Indtast et tal mellem 1 og 4 (E for exit)
    if /i {%ANSWER%}=={1} (goto :1)
    if /i {%ANSWER%}=={2} (goto :2)
    if /i {%ANSWER%}=={3} (goto :3)
    if /i {%ANSWER%}=={4} (goto :4)
    if /i {%ANSWER%}=={e} (goto :exit1)

    goto :exit

    :1
    cls
    echo Du har valgt %ANSWER% time
    @Echo Off
    set t=%ANSWER%
    set/a h2="h+t"
    set tid=%h2%:%m%
    if /i {%tid:~0,2%}=={24} (goto :24)
    goto :continue

    :2
    cls
    echo Du har valgt %ANSWER% timer
    @Echo Off
    set t=%ANSWER%
    set/a h2="h+t"
    set tid=%h2%:%m%
    if /i {%tid:~0,2%}=={24} (goto :24)
    if /i {%tid:~0,2%}=={25} (goto :25)
    goto :continue
    :3
    cls
    echo Du har valgt %ANSWER% timer
    @Echo Off
    set t=%ANSWER%
    set/a h2="h+t"
    set tid=%h2%:%m%
    if /i {%tid:~0,2%}=={24} (goto :24)
    if /i {%tid:~0,2%}=={25} (goto :25)
    if /i {%tid:~0,2%}=={26} (goto :26)
    goto :continue
    :4
    cls
    echo Du har valgt %ANSWER% timer
    @Echo Off
    set t=%ANSWER%
    set/a h2="h+t"
    set tid=%h2%:%m%
    if /i {%tid:~0,2%}=={24} (goto :24)
    if /i {%tid:~0,2%}=={25} (goto :25)
    if /i {%tid:~0,2%}=={26} (goto :26)
    if /i {%tid:~0,2%}=={27} (goto :27)
    goto :continue

    :24
    set h2=00
    set tid=%h2%:%m%
    goto :imorgen

    :25
    set h2=01
    set tid=%h2%:%m%
    goto :imorgen

    :26
    set h2=02
    set tid=%h2%:%m%
    goto :imorgen

    :27
    set h2=03
    set tid=%h2%:%m%
    goto :imorgen

    :imorgen

    set /a d=%date:~0,2%
    set /a m=%date:~3,2%
    set /a y=%date:~6,4%

    :loop
    set /a d+=1

    if %d% gtr 31 (
    set d=1
    set /a m+=1

    if %m% gtr 12 (
    set m=1
    set /a y+=1
    )
    )

    xcopy /d:%m%-%d%-%y% /h /l "%~f0" "%~f0\" >nul 2>&1 || goto loop

    set d=0%d%
    set m=0%m%

    set dato=%d:~-2%/%m:~-2%/%y%
    goto :continue


    :continue
    Echo .
    Echo .
    Echo Computeren lukker Kl %tid% den. %dato%
    Echo .
    Echo .
    SET /P ANSWER2=Passer dette? (J/N)
    if /i {%ANSWER2%}=={j} (goto :yes)
    if /i {%ANSWER2%}=={n} (goto :no)

    :yes
    cls
    @Echo --------------------------------------------------------------------
    @Echo Du valgte Ja
    @Echo --------------------------------------------------------------------
    @Echo .
    schtasks /Create /TN Shutdown /SC ONCE /ST %tid% /sd %dato% /TR "shutdown /s /t 0"
    @Echo .
    @Echo --------------------------------------------------------------------
    @Echo Computeren slukkes nu Kl %tid%
    @Echo --------------------------------------------------------------------
    Pause
    Exit

    :no
    cls
    @Echo Du valgte Nej

    @Echo --------------------------------------------------------------------
    @Echo Fjerner eventuelt gemte lukninger og lukker program.
    @Echo --------------------------------------------------------------------
    schtasks /Delete /tn Shutdown
    PAUSE
    Exit

    :exit
    cls
    @Echo Du valgte ikke en gyldig mulighed, Starter forfra.
    @Echo .
    @Echo Tryk E + Enter i menuen, hvis du vil lukke programmet.
    @Echo .
    Pause
    Call vista_timer.bat
    Exit

    :exit1
    Exit


    I know that this is written in Danish, but i think that people will be able to translate into there own needs.

    //Xserv4real

Similar Threads

  1. Creating .dst file format
    By Cheenu in forum Windows Software
    Replies: 5
    Last Post: 21-07-2011, 07:08 PM
  2. Replies: 5
    Last Post: 12-08-2010, 11:36 PM
  3. Creating Icons for Shutdown and Reboot
    By Orlando in forum Tips & Tweaks
    Replies: 2
    Last Post: 21-03-2009, 05:29 PM
  4. Creating a shutdown Program
    By Spencer in forum Software Development
    Replies: 4
    Last Post: 10-02-2009, 10:46 AM
  5. Replies: 2
    Last Post: 04-02-2009, 10:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,653,310,094.07478 seconds with 17 queries