Question Locked

HELP - BATCH File Error: "as unexpected att his time"

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Trying to create a simple batch utility to collect some random information.

I am having an issue with the variables in the batch file:

@echo This utility will create or append the failed barcode file.
@echo off
for /f "tokens=1,2,3 delims=/\-. " %%i in ('date /t') do (set FILENAME=%%i%%j%%k.txt)
if exists %FILENAME% THEN goto APPEND

cls
@echo To end this utility, Press F6 and ENTER
@echo Scan long trays:
@echo off
COPY CON %FILENAME%

GOTO END

:APPEND
cls
@echo To end this utility, Press F6 and ENTER
@echo Scan long trays:
@echo off
COPY %FILENAME% + CON

:END

I get this error message:
This utility will create or append the failed barcode file.
Mon0713.txt was unexpected at this time.

Can't figure out why...

2 replies

by Member 25348569

The correct way to determine if the file has already been created is

IF EXIST %FILENAME% THEN...

No 'S'

Neil :)

Enjoy!

This discussion is closed to new replies.