Solved how to shut down windows xp with a batch file

Dell / DIMENSION 2400
March 5, 2014 at 09:26:47
Specs: Windows 7 64 bit, i7-3770k / 8 gigs
A friend of mine is running xp pro, and I made the mistake of telling him that I click on an icon in my windows 7 ultimate, that will then copy certain folders from my C drive to my mirror D drive, and then it shuts windows 7 off.

Now he has asked me if I can do that for his XP machine.

Is it possible to do that with windows XP pro?

message edited by JohnFL


See More: how to shut down windows xp with a batch file

Report •

✔ Best Answer
March 6, 2014 at 10:27:03
The XCOPY command you posted is the same supported by XP. The following batch works under XP, assumed your friend has to backup his data from the Data folder.

@echo off
xcopy C:\Data\*.* D:\Data\*.* /d /e /v /y
shutdown -s

To generate the icon on the desktop select the batch file in Explorer, right click Copy, then on the desktop right click and select Paste Link. Now right click the icon generated select Properties, rename as Shutdown and change the picture choosing the red button for power off. You are done.



#1
March 5, 2014 at 09:40:23
Absolutely YES. Code your batch as you want copying the files you need to be backed up and as last statement insert

shutdown -s


Report •

#2
March 5, 2014 at 10:04:09
Thanks Ivo.

The batch file I have for my windows 7 looks like this, this is just one line of course:

start /w xcopy C:\Data\*.* D:\Data\*.* /d /e /v /y

would I need a different copy command for XP?



Report •

#3
March 5, 2014 at 10:19:03
On the WinXP box, open the Command Prompt and type:
xcopy /?

How To Ask Questions The Smart Way


Report •

Related Solutions

#4
March 6, 2014 at 10:27:03
✔ Best Answer
The XCOPY command you posted is the same supported by XP. The following batch works under XP, assumed your friend has to backup his data from the Data folder.

@echo off
xcopy C:\Data\*.* D:\Data\*.* /d /e /v /y
shutdown -s

To generate the icon on the desktop select the batch file in Explorer, right click Copy, then on the desktop right click and select Paste Link. Now right click the icon generated select Properties, rename as Shutdown and change the picture choosing the red button for power off. You are done.


Report •

#5
March 6, 2014 at 11:39:45
Gotta feeling shutdown /s is more universal than shutdown -s
(the latter hung on my Win8.1 64 bit).

Always pop back and let us know the outcome - thanks


Report •

#6
March 7, 2014 at 03:58:00
Windows' on-line help for the shutdown command suggests the character - to mark the switch as the Unix convention. Anyway to force the shutdown, no matter the application running, add -f, i.e. shutdown -s -f.

Report •

#7
March 7, 2014 at 11:14:38
Thanks IVO. It was my bad - didn't wait long enough (hadn't specified t).
Strange how the syntax tolerates both the / and - versions.

Always pop back and let us know the outcome - thanks


Report •

#8
March 7, 2014 at 13:38:14
Not that strange; it was based on the SysV command of the same name.

My memory's fuzzy, but I remember the version included with NT4 resource kit only allowed dashes.
When they added it to Windows, they must have added slash support to bring it in line with Window's standards.
Then in Vista, they rewrote the help text and now they recommend slashes. From Win7:

H:\>shutdown /?
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]
With Win8+, Microsoft pushes the PowerShell command Stop-Computer.

How To Ask Questions The Smart Way


Report •

#9
March 7, 2014 at 14:23:15
Thanks for the info Razor. Seems like I became a "slash" convert somehow.

Always pop back and let us know the outcome - thanks


Report •

Ask Question