Rainer Meier schrieb: (...) >> I have no idea. A bug? Which doesn't show up on real machines, though, >> which is either good or bad. > > Sure? I thought that Bug 106 is reporting a problem where WPKG service > seems to wait for the maximum logon delay. Probably there is really an > issue. If I have some spare time I will try to verify it on my VMWare. Bug 106 is a problem, but it's really hard for me to communicate with the bug reporter. So it may or may not be an invalid report. >>> @echo off >>> ping -n 1 <IP of server> >NUL >>> exit /b %errorlevel% >>> >>> This script returns 0 if the server is reachable and 1 if not. I've >>> tested this on the command line. >> >> The script is rather simple and primitive, but already contains an >> error ;) - it won't work with /b switch. >> Although this script will exit with non-zero code, /b prevents closing >> of cmd.exe. A while later cmd.exe exits with code 0, and... > > No. The 'exit /b %errorlevel%' is entirely correct. See 'exit /?'. On my > Vista it reads: It is a correct switch, but using it prevents passing a proper exit code to WPKG Client. > [...] > /B specifies to exit the current batch script instead of > CMD.EXE. If executed from outside a batch script, it > will quit CMD.EXE > [...] > > So when using exit /b within a script you can exit a script with a > certain exit code (%errorlevel% inserts the exit code of the immediate > previous command). Whether /b is used or not, it will exit a script with certain exit code. > When /b is not used, then exit will not only exit the > current script but terminate the whole CMD.EXE process. In other words, without /b, cmd.exe will terminate with exit code specified in "exit" command. With /b, cmd.exe will exit with exit code 0. When we want to "fetch" the exit code in WPKG Client, /b switch must not be used. > Which means that > if you run exit within a script invoked by another one ('call > script.cmd') it will never return and continue in the calling script but > terminate completely. If 'exit /b <code>' is used, it will terminate the > called script returning the specified code. -- Tomasz Chmielewski http://wpkg.org |