Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Need advise.

Original Message
Name: mamister
Date: March 26, 2008 at 23:45:30 Pacific
Subject: Need advise.
OS: WinXP Pro
CPU/Ram: 1GB
Model/Manufacturer: DIY
Comment:
I would like to run a bat file whenever the shut down button is click.

Is this possible?


Report Offensive Message For Removal


Response Number 1
Name: IVO
Date: March 27, 2008 at 03:27:40 Pacific
Subject: Need advise.
Reply: (edit)
Yes, but you have to setup your own shutdown button by a new shortcut, maybe placed on the desktop.

If interested how-to follows...


Report Offensive Follow Up For Removal

Response Number 2
Name: mamister
Date: April 2, 2008 at 01:38:17 Pacific
Subject: Need advise.
Reply: (edit)
Hmm... what i mean is this:

I have schedule a backup on every tuesday and friday nite to the company server.

I wanted to do it around midnight because I have many files and may take hours and don't want to affect the others speed for accessing the server.

The thing is that sometimes I forgotten about the backup and I shut down the pc before I left.

So what I wanted to do is:

Once I click the start -> turn off computer, it will appear a message:

" Hey, you have a backup session later, are you sure you want to shut down?"

Y for yes, N for no

That's it.

Any suggestion?


Report Offensive Follow Up For Removal

Response Number 3
Name: IVO
Date: April 2, 2008 at 14:28:51 Pacific
Subject: Need advise.
Reply: (edit)
As I said, you can do that in a straightforward way by setting up your own shutdown shortcut (with the red button icon) on the desktop and click that to power off the computer. Then it's just matter of routine to change your way of life (on the other side you do not hit the power off key on the keyboard to shutdown).

Any way to set up what stated

- create the following batch

:: shut.bat
@echo off
color 1E
:LOOP
cls
echo.
echo.-- Hey, you have a backup session later --
echo.
echo.-- are you sure you want to shut down ? --
echo.
set /P Q=Enter Y/N^>
if /I "%Q%"=="Y" shutdown -s
if /I not "%Q%"=="N" goto :LOOP
:: end_of_batch

- save shut.bat in e.g. C:\
- create a shortcut on the desktop to C:\shut.bat and right clicking select Properties where you can name it SHUTDOWN and select the red button icon (sheet Link/change icon)

you are done.

Other fancy ways require more sophisticated methods beyond my know-how.


Report Offensive Follow Up For Removal

Response Number 4
Name: mamister
Date: April 2, 2008 at 16:58:52 Pacific
Subject: Need advise.
Reply: (edit)
Hey that is cool. I tried your bat file, but it didn't shut down when I enter Y ?

Report Offensive Follow Up For Removal

Response Number 5
Name: IVO
Date: April 3, 2008 at 01:52:34 Pacific
Subject: Need advise.
Reply: (edit)
Glad you appreciate it, but what do you get entering Y/y and then pressing the ENTER key?

Let me know as I tested the script and it worked fine on my Win XP SP2 system.

Any way get the following improved version of the shut.bat (a bit more fancy)

:: shut.bat
@echo off
color 4E
:LOOP
cls
echo.
echo. ## Hey, you have a backup session later ##
echo.
echo. ## are you sure you want to shut down ? ##
echo.
Set Q=
set /P Q= ###### Enter Y/N then hit ENTER^>
if /I "%Q%"=="Y" shutdown -s -f
if /I not "%Q%"=="N" goto :LOOP
Set Q=
color 0E
exit
:: end_of_batch


Report Offensive Follow Up For Removal


Response Number 6
Name: mamister
Date: April 3, 2008 at 19:46:43 Pacific
Subject: Need advise.
Reply: (edit)
Hmm... Nothing happens when I enter the Y

Report Offensive Follow Up For Removal

Response Number 7
Name: IVO
Date: April 4, 2008 at 05:37:50 Pacific
Subject: Need advise.
Reply: (edit)
Replace the following statement

if /I "%Q%"=="Y" shutdown -s -f

with

if /I "%Q%"=="Y" %SystemRoot%\system32\shutdown -s -f

This should fix the bug, otherwise add <& PAUSE> (without the brackets <>) at the end of the line and please report the message displayed. There is no reason the script doesn't work as planned.


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Need advise.

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




DSHUB24 Connection Problems

need help with dsl and dial up

novel 3.12

help mandriva install last straw!

Icon Scaling in Explorer Bar


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC