![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject[>>] [<<]Thread[>>]
Number : 4750 Date : 2003-06-04 Author : Garry Deane Subject : Re: xxcopy to CD-RW Size(KB) : 3
--- In xxcopy@yahoogroups.com, Kan Yabumoto wrote: > The code you suggested earlier is quite sufficient > in my view. The "problem" you are trying to address > by the much longer script is a result of totally > unreasonable operation on users part. If the > user has no idea what the PATH= setting does, > there is no hope that he can manage executing > the proper copy of the XXCOPY.EXE file. I tend to agree. I would expect that new users will double click on INSTALL.BAT and experienced users will CD to the appropriate directory or specify the path. > I'm always amazed that people like you can create > a bullet-proof batch script like that. As it turned out, I was able to "break" it by creating a path which included an un-quoted directory with a space in it. I think this is illegal in W9x but is legal in NT/W2k/XP. If the %OS% variable is altered for whatever reason, the code will go into an infinite loop. If anyone is following this thread and is interested, the code snippet after :chkpath should be changed to: :: Search for this batch file in the path :ckpath set rec= if exist %1.\%src% goto found shift if "%1"=="" goto :notfound goto :ckpath :found > One solution is to provide a more unique name > than "INSTALL.BAT". But then, typical (experienced) > user would have hard time guessing which one in the > unzipped files in the temporary directory. > > As I said earlier, the solution should be fairly > "elegant". Although the new and much longer version > may close the hole for the rare case, the sheer > length alone disqualifies itself. That is, > I have hard time following the batch script > (mostly my lack of mental energy to fully > comprehend what is going on in the batch file). > When, the script become too long, it would be > understood only by a very few advanced users only. > > One benefit of the batch file is that it is a > "well-understood" rules which most people can > follow by just looking at it. When the required > action for the very rare cases makes the batch > file much longer, then, the benefit evaporates. Yes I agree. I just wasn't sure whether you wanted to eliminate a source of potential trouble or at least know abot it. The difficulty of course is that when the batch is complex, remotely troubleshooting a failed run with an inexperienced user can become a nightmare. KISS still works well. > So, I'm just about ready to incorporate your > first suggestion (which is very elegant and works > well). I'm thinking about putting a text which > gives you the credit for the code if you don't > mind (If you have objection, I will not put your > name in it). The first section of the batch > file will look like this: No I don't really want any credit since the NT/W2k/XP method is fairly commonly known and the credit for the DOS/W9x method belongs to others. I would suggest however that the NT/W2k/XP line is changed to: if "%OS%"=="Windows_NT" ((cd /d %~dp0)&(goto next)) This is slightly more obvious, is documented (see call /?), is bullet-proof and should survive any potential future changes to CMD.EXE I also recommend that you leave the "if not exist install.bat goto error1" test and error message in place in case it does break. > Again, thank you for your great help. A pleasure to contribute in a small way to a great program. Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.