Odd batch file error (Vista & XP)

Jagdriver

Honorable
Jul 30, 2012
6
0
10,510
I'm having a problem with a CMD-style batch file on both Vista and XP machines where the SysVars check out fine (using the SET command at a prompt). PAUSE isn't helping at all, either, in that the CMD window briefly appears, then quickly disappears, when double-clicking the file's icon. Placing the file on my Desktop during testing, I'm having to open a CMD window, change to the Desktop directory and run it directly from the prompt to even see what's going on. Since the referenced ClassicShell.chm file does not exist, I'm expecting to see the echo message.

File contents:

@if exist %programfiles%\Classic Shell\ClassicShell.chm goto Folder_OK
echo CS path different. Email this error message.
pause
exit

Regardless of what I do, this is what is returned:

C:\Users\Me\Desktop>■@
'■@' is not recognized as an internal or external command,
operable program or batch file.

What gives?
 

Jagdriver

Honorable
Jul 30, 2012
6
0
10,510
Nope. That is not the issue. There isn't a spurious character to the left of the @. I've recreated the file several times from scratch on two machines, both yielding the exact same result.
 
I just copied and pasted what you put in here to a new .cmd file, it ran with no errors on XP.

Something is reading a character in front of the @ sign. What if you delete that and just use the "if" as the first thing? Does that run.

BTW, you probably want to put the @ in front of the echo command also so it does not pop up when you run the file.
 

Jagdriver

Honorable
Jul 30, 2012
6
0
10,510
No to your question. It apparently doesn't like the sysvar in the if exist statement, so I've just made it into several lines instead of one, making liberal use of CD changes to accomplish the task.

The echo line is a continuation of the first line. It is what is supposed to be reported to the user (not me) if the file existence test fails.