1.

Solve : Creating a variable in 16-bit DOS?

Answer»

Hello all,

I am using 16-bit DOS (i.e. COMMAND.com as opposed to cmd.exe) and I am having some trouble.

I have a .bat file that works perfectly fine in 32-bit DOS (cmd.exe) but does not work with COMMAND.COM. The script basically runs a program CHKCPU.EXE with the /S switch, which essentially returns a value for the processor SPEED. What I need to do is get this value into a variable %processor%. As I said, this works in cmd.exe, but not with command.com. I understand that cmd.exe has some extra bells and whistles, so this is not a total surprise... but for the life of me I cannot figure out how to perform the same task in command.com.

Here is the .bat file that works in cmd.exe

rem Put the returned value of chkcpu into the file $temp$
chkcpu /s > r:\$temp$
rem Put the contents of $temp$ into the variable %processor%
set /p processor=rem REMOVE the first 10 characters of %processor%
set processor=%processor:~10%
rem DISPLAY the value of %processor%
echo %processor%

Trying these lines individually, the first command (chkcpu /s > r:\$temp$) works like a charm. However, the commands involving "set..." do not work. Is there an alternative to using this? Is there a SET.COM or SET.EXE that I can acquire that is not embedded in COMMAND.COM?

Thank you,
-darrylThere is, I cant quite put my hands on what you want, but this page of links will undoubtedly SOLVE your problem
http://dmoz.org/Computers/Software/Operating_Systems/x86/DOS/Programming/Languages/Batch/
Cheers
GrahamGorgeous.



Discussion

No Comment Found