G
Guest
Not sure where to post this...but I am having some trouble with a Shell Script.
I am getting an error when I use the CALL command in the shell script.
While the doc and the CALL /? doc both show that a CALL :Label arguments is a
valid way of using the function, I can't seem to get it to work.
In a generic script I can make it work with something simepl like this:
Using it at the command prompt like MYTEST.BAT input text here, results in an
echo of the text inputed.
@ECHO OFF
SET ISSUED=%1
CALL :TEST %ISSUED%
GOTO :EOF
:TEST
echo hello %1
pause
:EOF
HOWEVER if I have something a little more complex: Like below, I get a Bad
Command or Filename when using the CALL function of the Shell. Any ideas why
this happening? (I over simplified the script to remove the excess fluff, and
added the debug string that I wanted to display to know where I am at
execution)...
Thanks
J
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
REM - - - - U_CRS.BAT - - - -
CLS
IF "%1"=="1" goto ONE
IF "%1"=="2" goto TWO
GOTO EOF
:ONE
SET ISSUED="C:\PATH\PATHLOC\IN\ISSUED.DAT"
SET RAWFILE="C:\PATH\PATHLOC\IN\ISSUED.DAT"
SET BLOCK="NORMAL_BLOCK_50"
GOTO PROCESS
:TWO
SET ISSUED="C:\PATH\PATHLOC\IN\OUTPUT.DAT"
SET RAWFILE="C:\PATH\PATHLOC\IN\SEMC??????.ISSUED"
SET BLOCK="NORMAL_BLOCK_50"
GOTO PROCESS
ROCESS
CALL :TEST %ISSUED%
echo after called test
pause
GOTO EOF
REM
******************************************************************************
REM *** FUNCTIONS
***
REM
******************************************************************************
:TEST
echo hello
echo %1
pause
:EOF
endlocal
EXIT
I am getting an error when I use the CALL command in the shell script.
While the doc and the CALL /? doc both show that a CALL :Label arguments is a
valid way of using the function, I can't seem to get it to work.
In a generic script I can make it work with something simepl like this:
Using it at the command prompt like MYTEST.BAT input text here, results in an
echo of the text inputed.
@ECHO OFF
SET ISSUED=%1
CALL :TEST %ISSUED%
GOTO :EOF
:TEST
echo hello %1
pause
:EOF
HOWEVER if I have something a little more complex: Like below, I get a Bad
Command or Filename when using the CALL function of the Shell. Any ideas why
this happening? (I over simplified the script to remove the excess fluff, and
added the debug string that I wanted to display to know where I am at
execution)...
Thanks
J
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
REM - - - - U_CRS.BAT - - - -
CLS
IF "%1"=="1" goto ONE
IF "%1"=="2" goto TWO
GOTO EOF
:ONE
SET ISSUED="C:\PATH\PATHLOC\IN\ISSUED.DAT"
SET RAWFILE="C:\PATH\PATHLOC\IN\ISSUED.DAT"
SET BLOCK="NORMAL_BLOCK_50"
GOTO PROCESS
:TWO
SET ISSUED="C:\PATH\PATHLOC\IN\OUTPUT.DAT"
SET RAWFILE="C:\PATH\PATHLOC\IN\SEMC??????.ISSUED"
SET BLOCK="NORMAL_BLOCK_50"
GOTO PROCESS
ROCESS
CALL :TEST %ISSUED%
echo after called test
pause
GOTO EOF
REM
******************************************************************************
REM *** FUNCTIONS
***
REM
******************************************************************************
:TEST
echo hello
echo %1
pause
:EOF
endlocal
EXIT