hi
I am writing long but simple batch. In some stage I got “The syntax of the command is incorrect.” in few commands, I am sure are correct (e.g. “IF EXIST “%PROGRAMFILES%\Saveresults\saveresult.exe” ( “.
Same command works properly when written in Command Prompt window or in another batch.
I tried to resave the batch, also in other editors, several times , but the result is the same.
editor: Notepad++, ANSI encoding, DOS/Windows format
What the **********, could be the catch ?
10x for help
p.s.
would be anybody willing to review and “tune up” the batch?
1. replace ECHO OFF with ECHO ON, inside the script
2. Run the script, and copy-paste ALL the output in this thread. You may not be sure that the command you show, is the one with the trouble. Also, what about the variable, you are never sure it contains the correct value, other than actually running the code, and looking at the output. Trust me, you can look at code as much as you want, debugging is done by means of testruns…
I don’t know what to tell you on this one, girls. The bat gives me no errors.
===============================
@echo off & setLocal EnableDELAYedeXpansion
:: this is a rem
if x equ x (
echo one
:: R2
: R3
echo two
)
For whatever goofy reason the compound won’t take a label/rem, of either single or double colon, immediately preceding the closind paren.
Like so many things in windows, no idea why. It JUST DOES.
=================================
This doesn’t work:
——————————
@echo off & setLocal EnableDELAYedeXpansion
:: this is a rem
if x equ x (
echo one
:: R2
: R3
echo two
: R4
)
==========================
This doesn’t work either:
—————————–
@echo off & setLocal EnableDELAYedeXpansion
:: this is a rem
if x equ x (
echo one
:: R2
: R3
echo two
: R4
@echo off
)
==============================
But this does:
—————————-
@echo off & setLocal EnableDELAYedeXpansion
:: this is a rem
if x equ x (
echo one
:: R2
: R3
echo two
: R4
echo off
)
==========================
sheesh