eyo technlogies For your PC needs
+ Reply to Thread
Results 1 to 2 of 2

Thread: SHELL Scripts

  1. #1
    Smurfman Guest

    SHELL Scripts

    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



  2. #2
    Smurfman Guest

    RE: SHELL Scripts

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


+ Reply to Thread

Similar Threads

  1. The shell stopped unexpectedly and %1 was restarted.
    By John J in forum microsoft.public.windowsxp.help_and_support
    Replies: 6
    Last Post: 10-04-2005, 02:46 AM
  2. The shell stopped unexpectedly and %1 was restarted.
    By John J in forum microsoft.public.windowsxp.help_and_support
    Replies: 0
    Last Post: 10-04-2005, 02:37 AM
  3. File Sharing & Properties wizard will not display
    By Mr Mike in forum microsoft.public.windowsxp.help_and_support
    Replies: 11
    Last Post: 10-04-2005, 01:43 AM
  4. Scripts in MS Word help
    By Stan Brown in forum microsoft.public.windowsxp.help_and_support
    Replies: 0
    Last Post: 09-04-2005, 07:47 PM
  5. Shell Hardware Detection is slowing down explorer.exe
    By Morten Høgholm in forum microsoft.public.windowsxp.help_and_support
    Replies: 2
    Last Post: 03-11-2004, 04:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts