Monday, 19 August 2013

GOTO was unexpected at this time

GOTO was unexpected at this time

We are trying to run a custom .BAT file that has worked fine under Win98
for years, but we just got a new server over the weekend and Win98 virtual
machine does not work now apparently. So, I'm trying to set this up so
it'll work through WinXP command prompt. What do I need to change to make
this work with XP?

I type in the .BAT file and it runs fine. It allows me to type in the
date, but when I type in the date as we normally do and hit enter, I get
"GOTO was unexpected at this time":

:CRLIST.BAT - DAILY C/R DEPOSIT LIST
:
@ECHO OFF
CALL SEARCH
CRDATE.EXE
IF EXIST DEPOS.LS DEL DEPOS.LS
CASHLIST.EXE
CALL QPR DEPOS.LS 2

I found GOTO in the QPR.BAT file. Here's the code for QPR.BAT:

:QPR.BAT - COPY SPECIFIED LISTING FILE ( .LS) TO SPECIFIED PRINTER PORT (1-9)
: WITH FF FOLL'G - LPTx MUST ALREADY BE CAPTURED TO DESIRED PRINTER
:
@ECHO OFF
IF "%1==" GOTO OPERR
IF "%2==" GOTO OPERR
COPY %1 LPT%2
CALL FF%2
GOTO END

:OPERR
ECHO Please re-enter this Print Queue command as follows:
ECHO QPR xxxxx.LS n
ECHO.
ECHO where xxxxx.LS is the name of the report listing file,
ECHO and n is the Network Printer No. on which to print.
:END

I've been reading different threads and I've tried changing "%1==" to
"%1"=="", same for %2, and it'll then give me a new message saying:

The system cannot find the specified file.
0 file(s) copied.
The system cannot find the specified file.
0 files(s) copied.

If I add "%%1"=="", "%%2"=="", and then add an extra % anywhere there is a
single one, it'll display:

The system cannot find the specified file.
The system cannot find the specified file.
0 files(s) copied.

Do I need to provide the code for anything else? There are a lot of .BAT
files so if I can get this figured out, they hopefully we can apply to the
rest of the commands.

No comments:

Post a Comment