InterviewSolution
| 1. |
Solve : Problem with %%parameter with script that was just working? |
|
Answer» I feel like I'm going crazy. This script just worked a few minutes ago and now its not. Here is my script, the purpose is to shutdown computers that are named in a list shutdown.bat There you go. So it's as simple as commands can not be the name of the script? No, it does not hurt the command. The command will work But the script or batch must not be the name of any program or built-in command. Example: In the same directory I have: ring.exe ring.bat Preferences is to the EXE.Quote from: indigoataxia on February 13, 2014, 02:04:39 PM So it's as simple as commands can not be the name of the script? You are trying to call shutdown.exe from a script called shutdown.bat. You are not using extensions. Just "shutdown". The command interpreter works like this when running a script - when it finds something that might be a command, it first of all looks in the current directory for a file or script with that name, If there are more than one, extensions take priority in this order listed in the %pathext% system variable, default value: .com; .exe; .bat; .cmd (even in 64 bit Windows .com is first!). If none are found, then the command interpreter looks, in turn, in all the folders listed in the %path% environment variable, using the %pathext% order. So if you don't use extensions, shutdown.bat in the same folder is going to take priority over shutdown.exe on the %path%. Shutdown.bat is going to call itself. The real Shutdown.exe will never get executed. Solution: In your batch, use shutdown.exe or even better C:\Windows\system32\shutdown.exe or better still, don't name your batch the same as a Windows command. It makes life easier. I 100% understand now. It was looping and erroring out because it kept calling itself endlessly. I will rename the script. Thanks a lot guys! |
|