bboysil

Distinguished
Oct 5, 2006
158
0
18,680
If you don't want to read the whole text just read the bolded lines.

I made the following batch file which shuts down the computer. I have to enter a number and then it waits that number of seconds till it shuts down, nothing fancy.

This is the source
[code:1:745b0c9515]
@echo off
set /P C=shutdown -s -f -t
shutdown -s -f -t %C%
[/code:1:745b0c9515]
Now here comes the interesting part
If i double click the icon on the destop it opens a command window with the message, waits for input, i type a number and press enter and then the same message apears on the following line, i type again, press enter and the same thing happens. It doesn't work!!
If i enter in Total Commander go to the desktop dir and execute the same batch file!!! IT WORKS!!

IT IS THE EXACT SAME FILE!!! Can anyone give me a clue why this happens, or could you try it yourself to see if it is the same. I am using
Windows XP Professional, version2002, SP2

[/b]PS To add to the strangeness of this situation if i move the file from the desktop to another dir, and execute it from My Computer or from Total Commander it doesn't work in both cases.
 

bboysil

Distinguished
Oct 5, 2006
158
0
18,680
I just tried this on the laptop of a friend of mine, but he has the same Windows installed from the same CD. It is the same thing as in my case.
 

bboysil

Distinguished
Oct 5, 2006
158
0
18,680
I know how to use shutdown.exe i just want to know if you have the same problem as i do and why is this happaning.

BTW
%windir%\system32\shutdown.exe -u -t 0 shuts down imidatly, i want to shut it down after the time i enter. But i already told it works if i execute it from total commander and doesn't from the desktop.

Just try it and tell me if it is the same, make a shortcut on the desktop, copy paste this code
[code:1:5fc348f8ef]
@echo off
set /P C=shutdown -s -f -t
shutdown -s -f -t %C%
[/code:1:5fc348f8ef]

and execute it directly from the desktop, then go from total commander type \\ to enter the desktop end execute the batch. Is it the same thing?