Anyone know the cause of error: " ' ' is not recognized as an internal or external command, operable program or batch file"?

britechguy

Well-Known Member
Reaction score
4,689
Location
Staunton, VA
All of a sudden, and fairly predictably, if I email someone a code segment for command prompt, if they copy and paste out of the email message and attempt to run it, this message comes up repeatedly. It's happened to me when I email something to myself, too, and it is pasted into Notepad. I simply cannot find the source of this issue and believe me, I've tried.

Here is the OneDrive link to a TXT file that one of my correspondents sent to me after he did a copy/paste of the simple for loop and pause commands it contains that throws this error message if I change the extension to BAT and attempt to run it. alfa.txt

I just can't find anything that should trigger this and figure that someone here has likely encountered it before.
 
Hey Brian,

You'll need to remove the spaces in front of the "echo %%i"

Edit: Because those spaces are in the brackets, and you have EnableDelayedExpansion enabled, I believe it's parsing out the spaces as the literal "NBSP" (Non-Breaking-Space) machine character
 
Last edited:
Aaron,

Thanks. That worked, but it doesn't explain why that fixes it in that case, yet the same code (with leading spaces) in this file, https://1drv.ms/u/s!AnTRg6T8vLYuj4s4SSswrhD-gD5afg?e=QtOAqB, works fine.

That's what the mystery is, and it seems to come from my having pasted code into a Gmail message body, and someone else copying it out of that message and pasting it into Notepad. I can even replicate it myself, but I don't know how that mystery " " ever enters the mix.

Brian
 
Ya, it's a weird one. How the two files were originally created/made seems to be the determining factor. Or, could it be because it went through email, "spaces" were changed into NBSP's? Not sure.

In Notepad++:
alfa.txt reads:
1733974165687.png

AlfaLoop3.BAT reads:
1733974200400.png

So, it's those NBSP's that are killing it.
 
Aaron, it has to be something related to a copy/paste into and out of a Gmail message, but not necessarily where the copying is happening in webmail.

The only time I'm getting this is when I do a direct copy from say, perplexity.ai, pasting it into Gmail in a message body, and sending that way. If I do that same copy, and paste into Notepad, it never happens.

I have no idea how a non-breaking space is being introduced. But now, at least, I have the workaround of just attaching a TXT file that the recipient can safely copy and paste from into a BAT they're creating, and the issue is not there.

I've been copying and pasting into Gmail message bodies for this sort of stuff literally for decades, and this issue has only reared its ugly head in the last several weeks.
 
Gmail is automatically removing "line breaks". There should be a setting to stop this action.

I'm guessing here:

From Google search AI:
To prevent Gmail from automatically removing line breaks, ensure you are composing your email in "HTML" format instead of "Plain Text" within your Gmail settings; this allows for more control over formatting, including line breaks.

How to change to HTML format in Gmail:
  • Open your Gmail inbox.
  • Click the gear icon in the top right corner to access settings.
  • Navigate to the "Compose" section.
  • Under "Compose messages in this format," select "HTML".
Key points to remember:
  • Plain Text removes extra line breaks:
    When composing in plain text, Gmail automatically removes unnecessary line breaks, which can lead to a cluttered appearance.
  • HTML allows for formatting control:
    By choosing HTML, you can manually insert line breaks using the "Enter" key, ensuring your message displays exactly as intended




 
@xrobwx71

I've used nothing but HTML formatted email, period, in Gmail webmail or otherwise in far longer than I can remember. The material being entered either has new lines entered by me, or they had been entered in Notepad or any other text-based source from which they were copied.

That's what makes this so mystifying. It's definitely a Gmail based problem, though.
 
Back
Top