batch in ME

July 8, 2009 at 21:03:42
Specs: Windows ME
my batch file is running ok in XP but when i
run it in ME, the program by passes the input
field...

how can i make batch file compatible with ME
thanks


See More: batch in ME

Report •


#1
July 8, 2009 at 23:00:50
Can you post the script?

There are a lot of commands/tools that are not available in dos, win9x and Me that are available in NT, 2000, xp and above.

A couple of the main deficiencies are the lack of for /f /r /d loops (so there is no built in way to read text files), code blocks, set /p, variable substrings and calling batch :labels.


Report •

#2
July 8, 2009 at 23:28:38
@ECHO OFF
:BEGIN

:NUMERIC
CLS
ECHO *******************************
ECHO * NUMERIC file initialization *
ECHO *******************************
SET /P fname= Enter Filename:
SET /P parameter= Enter Parameter:
echo You entered Filename: %fname%
echo You entered Parameter: %parameter%
echo Please check your input, strike ENTER once your 
ready.
PAUSE

COMMAND /C 2.bat

:MENU
CLS
ECHO.
ECHO **************************************************
ECHO * PRESS 1 or 2 to select your task, or 3 to EXIT *
ECHO **************************************************
ECHO.
ECHO 1 - Append file?
ECHO 2 - Finished File?
ECHO.
SET /P M=Type 1 or 2 then press ENTER :
IF (%M%)==() GOTO MENU_MISSING
IF %M%==1 GOTO APPEND
IF %M%==2 GOTO DONE
REM IF NOT %M%==1 GOTO MENU_MISSING
REM IF NOT %M%==2 GOTO MENU_MISSING
GOTO NUMERIC

REM IF %M%==3 GOTO NUMERIC
REM IF %M%==4 GOTO EOF
:APPEND
echo Filename: %fname% is append.
copy %fname%.DTA z:\Append
copy %fname%.OS# z:\Append
del  %fname%.DTA
del  %fname%.OS#
SET %fname% == ()
SET %parameter% == NULL
PAUSE

GOTO NUMERIC

:DONE
echo Filename: %fname% is Done.
copy %fname%.DTA z:\commonfolder
copy %fname%.OS# z:\commonfolder
del  %fname%.DTA
del  %fname%.OS#
SET %fname% == NULL
SET %parameter% == NULL
PAUSE

GOTO NUMERIC

:MISSING
echo no value
pause
GOTO NUMERIC

:MENU_MISSING
echo no value
pause
GOTO MENU

:EOF
ECHO "GoodBye"

:END


Report •

#3
July 9, 2009 at 00:23:14
"SET /P fname= Enter Filename:
SET /P parameter= Enter Parameter:"

This is a problem as "set /p" is not present in Me, the only available(without copying the executable from elsewhere) alternative it choice, which only takes one character of input - not so good for file names(but can be done, I have a script that does this but is not pretty). Inversely choice is not present in nt, 2000 or xp (apparently it's in vista).

The easy solution would be to use paramers "yourbatch filename param2 param3 ect.", The %1 would be the filename and the other parameters would be %2, %3 and so on, but it would need you to start the script from the command line rather than double clicking on it(eg c:\>yourbatch filename otherstuff).

Failing that I would suggest you get a copy of command.com from Freedos (it must be from freedos because the freedos command.com supports set /p), rename it to something like "fdos.com" and put it into the same directory as the script in me. Then you would only need to add one line to the to of the script "if not "%os"=="Windows_NT" fdos.com" an extra exit at the end may also help.


Maybe someone else will have a more elegant solution (debug script?).


Report •

Related Solutions

#4
July 9, 2009 at 00:37:11
what will i do with command.com?


Report •

#5
July 9, 2009 at 00:46:18
I was suggesting you do absolutely nothing with Me's command.com. What I was saying was that if you get a copy of freedos' command.com (and rename it to avoid confusion) you could invoke it by using the %os%(on nt, 2000, xp, vista it should be Windows_NT) variable and an if statement.


It's not a very good solution though, as you would need to have the executable with the script.

Freedos can be downloaded for free.

It's been a while since I used any version of windows prior to xp and I'm drawing a blank on other solutions.........


Report •


Ask Question