Odd batch file error (Vista & XP)

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.

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

'■@' is not recognized as an internal or external command,
operable program or batch file.

What gives?
4 answers Last reply
More about batch file error vista
  1. You have a character before the @ in the file. Create a new text file, do not cut and paste the old contents.
  2. 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.
  3. 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.
  4. 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.
Ask a new question

Read More

Configuration Windows Vista Command Prompt Windows XP