[<<]Message[>>]    [<<]Author[>>]    [<<]Subject[>>]    [<<]Thread[>>]

Number : 4757 Date : 2003-06-05 Author : Garry Deane Subject : Re: xxcopy to CD-RW Size(KB) : 1
--- In xxcopy@yahoogroups.com, Kan Yabumoto wrote: > I just wonder if they ever came up with a cleaner > version to make the errorlevel test less awkward. > > That is, the following mess should be cleaned up > with something more straightforward. > > if errorlevel 10 if not errorlevel 11 ... > > to something like > > if erroris 10 ... > Yes, this has been tidied up. Errorlevel is now assigned to the environment variable %errorlevel%. The old "IF errorlevel nnn" syntax still works but now you can do: if %errorlevel% == 5 ... if %errorlevel% EQU 10 ... if %errorlevel% LSS 20 ... if %errorlevel% GEQ 15 ... Additionally there are 2 new conditional pipes, && and || which execute depending on the success or failure of the preceding command. echo test |find "sr" > nul && echo found||echo not found The batch language in CMD.EXE has been strengthened quite remarkably from that in COMMAND. The extensions to FOR, SET, IF, CALL and others make it a quite capable tool. If anyone is interested, take a look at http://www.commandline.co.uk/cmdfuncs/dandt/index.html. Your eyes will probably glaze over at what is there but it will give a feel for what can be achieved with the 'humble' batch language. > As to the final version, the following is my final > version which will be included in our future releases > of the XXCOPY package. > > ---------------------------------------------------- > if "%OS%"=="Windows_NT" ((cd /d %~dp0)&(goto next)) > echo %0 | find.exe ":" >nul > if not errorlevel 1 %0\ > cd %0\.. > :next > ---------------------------------------------------- Yes much tidier. I should have thought of that myself. The usual problem of getting too close to the writing/code that the obvious is overlooked. Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.