|
Answer» I've been WRITING a batch file on my windows 2000 machine and it worked fine (obviously because of NEWER version of cmd.exe). However, when I threw it on a bootdisk and booted on another system and runthe batch file once I get to the prompt it gives me a variety of errors. As a result I'm left with two questions, 1) Is there anyway to make a bootable cd/floppy with the win2k version of dos (cmd.exe) on it? and/or 2) How can the following code be modified to work with elder versions of DOS: Code: [Select] :imageshow if "%image%"=="" ( echo . echo /==================================================================== echo ! You have not selected an image yet! Please select an image. echo \==================================================================== echo . pause goto start )
) else ( echo . echo /==================================================================== echo ! You have selected the following image: echo ! %image% echo \==================================================================== echo . pause goto start http://www.easydesksoftware.com/recovery.htm#NeededWindows 2000 does not have a true MS-DOS command processor, CMD.EXE is not the same as MS-DOS command. There is no way to fit CMD.EXE and enough stuff to actually make it go on a floppy. Is here any way to modify the code to work in DOS? For example, I have:
Code: [Select] :ghost cls echo . echo /==================================================================== echo ! Norton Ghost Menu echo \==================================================================== echo ! 1. Run Ghost Imager echo ! 2. Verify Current Image echo ! 3. Verify SID echo ! 4. Exit to Main echo \==================================================================== echo . choice Your choice /c:1234 if errorlevel 4 goto start if errorlevel 3 goto verifysid if errorlevel 2 goto imageshow if errorlevel 1 goto runghost
I want to verify the SID they enter at promt as %1 (c:\ghoster.bat 00-00000-00000)
Code: [Select] :verifysid if "%SID%"=="" ( echo . echo /==================================================================== echo ! You did not set the new SID for the computer being imaged. echo ! Please re-run this script with the following syntax: echo ! Usage: menu.bat [COMPUTERSID] echo ! Desktop Example: menu.bat 04-D0003-0450X echo ! Laptop Example: menu.bat 04-L0003-0450 echo \==================================================================== echo . pause goto start )
) else ( echo . echo /==================================================================== echo ! You have set the new computer sid to the following: echo ! %SID% echo \==================================================================== echo . pause goto ghost
This will not work in DOS, I cannot figure out how to parse/space it correctly.
Also another problem that I cant seem to quite grasp the concept of, when running the ghoster. The following works in Win2k of course, but how to get it working in dos?
Code: [Select] :runghost if "%image%"==""( echo You have not selected an image yet, please do so from the menu. goto image )
) else ( p: ghost /fni -clone,mode=load,src=%image%,dst=1 -sure ghstwalk /cn=%SID% /SURE
Here's what I tried in dos: Code: [Select] if exist %image% goto runghostpass if not exist %image% goto runghostfail :runghostpass ghost /fni -clone,mode=load,src=%image%,dst=1 -sure :runghostfail echo image does not exist, pls select a valid image goto image
Any help is greatly appreciate, thanks in advance! Wow, I just read over that and I even confused myself haha. Sorry
Ok, here's a clear question:
a) How do I test to see if %1 is NULL (not typed in by user after running c:\ghoster.bat). I am using IF X%1==X goto Failure, this works but seems to be buggy a bit? BETTER solution?
b) More importantly, how do i test %1 to verify that SOMETHING, anything, has been entered
Thanks againThat CONSTRUCT has worked for years for me in all versions of MS-DOS and Windows from MS-DOS 3.1. This construct should work 100% of the time, I'm not aware of anything that will cause it to fail.
IF X%1 == X GOTO NOTHING ... process parameter... GOTO END :NOTHING ... missing parameter error ... :END
Thanks john, it's working GREAT. However for some extra error checking I am still wondering if there is a way to test if he user has inputted something for %1.I guess I don't understand. If the comparison succeeds, there is nothing in the %1 parameter, if it fails, he entered something.
Are you trying to validate what he's entered? If so, that's a totally different problem, all this IF does is tell you that there was a parameter following the batch file name. Yes, I wasn't wording my question correctly. I was able to apply your solution to my problem and I have it all working now. Thanks!
|