1.

Solve : DOS BATCH IN WIN_XP?

Answer»

I am using FTP on a win XP machine to move files to a UNIX server. The files must be uniquely named for each station running the batch program. I am limited to two (2) characters in the naming convention. I think using tokens is the answer but have no idea how to do it. I have tried using "choice" instead of my NT COMPILERS "getinput" but have had no luck with that either

echo !rename BAR*.00* BAR*.%result%*>> c:\pcldt\system\send.bat

I am currently using %result% = (1-99 / 01-99) but need the ability to have thousands of unique NAMES using only two (2) characters. So I want to limit the user input to allow only two characters at the input line but allow for (1-99 / 01-99) (AA-ZZ) (1A-9Z) (A1-Z9) (1a-9z) (a1-z9) (Aa-Zz) (aa-zz).

I don't want to have to write 20,00 lines of (if) to cover all the possible INPUTS. and I need to prevent the user from inputting more than two (2) characters into %result%

Here is a small piece of the batch program where I call for the user input.

:getldtid
color 3f
REM printcolor Enter your unique station ID. Must be 1-99: 4 14
REM getinput
REM printreturn
cls
if /I %result% EQU 1 SET result=01
if /I %result% EQU 2 set result=02
if /I %result% EQU 3 set result=03
if /I %result% EQU 4 set result=04
if /I %result% EQU 5 set result=05
if /I %result% EQU 6 set result=06
if /I %result% EQU 7 set result=07
if /I %result% EQU 8 set result=08
if /I %result% EQU 9 set result=09
if /I %result% LSS 1 goto getldtid
if /I %result% GTR 99 goto getldtid
echo %result%>> c:\pcldt\system\ldtid
attrib +R +h c:\pcldt\system\ldtid
goto buildit
goto exit



Unless I'm mistaken the station id can be two letters, or two numbers, or a letter and a number. This may work:

Code: [Select]
@echo off
:start
color 3f
set /p id=Enter Your Station Id:

for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
for %%b in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
if /i %id%==%%a%%b goto OK
)
)

for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
for /l %%b in (0,1,9) do (
if /i %id%==%%a%%b goto OK
if /i %id%==%%b%%a goto OK
)
)

for /l %%a in (0,1,9) do (
for /l %%b in (0,1,9) do (
if %id%==%%a%%b goto OK
)
)

echo Invalid Station Id...Try Again
goto start

:OK

rest of your logic goes here


Better check my version of the alphabet.

Hope this helps.

PS. Color 3f looks like something Linda Blair shot up in "The Exorcist"Regarding color 3f; everyone in the department said the same thing. I thought they were just being the guys and giving me sh. My wife and kids said the same.

Dang I guess 3f goes.

regarding you're fix... You are a DOS batch GOD! this will work perfectly and you made it happen so easily. I am so lame....

Thanks



Discussion

No Comment Found