G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.help_and_support (More info?)

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
:pROCESS

CALL :TEST %ISSUED%

echo after called test
pause

GOTO EOF

REM
******************************************************************************
REM *** FUNCTIONS
***
REM
******************************************************************************

:TEST
echo hello
echo %1
pause

:EOF
endlocal
EXIT
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.help_and_support (More info?)

One thing I forgot, which will explain something that might help...

If I browse to the script in a CMD shell and execute the script by entering
the bat file followed by the command arguments, it works just fine.

However, if I use a PIF that already has the Command Line Arguments in the
shortcut, that is where it does not work. (using the _DEFAULT PIF) This is
where things do not work properly.

Thanks
J

"Smurfman" wrote:

> 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
> :pROCESS
>
> CALL :TEST %ISSUED%
>
> echo after called test
> pause
>
> GOTO EOF
>
> REM
> ******************************************************************************
> REM *** FUNCTIONS
> ***
> REM
> ******************************************************************************
>
> :TEST
> echo hello
> echo %1
> pause
>
> :EOF
> endlocal
> EXIT
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.help_and_support (More info?)

Hi,

It appears that this is a Development related request and would best be
addressed in the Developer newsgroups. I have provided the link below:

http://msdn.microsoft.com/newsgroups/default.asp

Or you may ask for developer support:
http://support.microsoft.com/directory/directory/phonepro.asp?sd=msdn

Thanks & Regards,

Jason Tan

Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

=====================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.