1.

Solve : String entry routine for DOS?

Answer»

I am looking for a "string entry" routine that can be included in a batch file; I need to enter a filename into a batch file and cannot figure out how to do it. I had a routine that I got from the internet a couple of years ago which I have reprinted below. Although I have NO CLUE how this works, it DID work FINE until the company upgraded my computer to Windows 2000 PROFESSIONAL. Now, whenever I try to use this routine, all I get is the error message:
FC: Cannot open CON - No such file or folder
Somebody please HELP!!

Old string entry routine is as follows:
> $tmp$.bat fc con nul /lbl /n|date|find " 1: "
> enter.bat echo set STR1=
>>enter.bat echo :loop
>>enter.bat echo if not '%%str1%%==' set str1=%%str1%% %%5
>>enter.bat echo if '%%str1%%' set str1=%%5
>>enter.bat echo shift
>>enter.bat echo if not '%%5==' goto loop
call $tmp$.bat
del $tmp$.bat
del enter.bat

The entered string is supposed to be in the variable %str1%
Using fc to get input from the keyboard is an old trick from Win95 days. Things are much easier today.

Code: [Select]@echo off
set /p str1=What's your name?
echo Hello %str1%!

Hope this HELPS. 8-)Works like a charm!!
Thanks a zillion.



Discussion

No Comment Found