Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

ECHOing the _CWD with a & in the path

Apr
1,794
15
I have EmailAddr.btm which is attached and it's causing output for example:

Code:
In: C:\Program Files (x86)\Cyberlink\WaveEditor\web
====
In: C:\Program Files (x86)\DoubleKiller Pro
====
In: C:\Program Files (x86)\Eltima Software
====
In: C:\Program Files (x86)\Eltima Software\SWF

OnError.btm: Not a valid command. You may edit it or
press ENTER to abort it.

FLV Player

[C:\]dir /a: "C:\Program Files (x86)\Eltima Software\SWF*"

Volume in drive C is Win7_Galloway   Serial number is aea6:a855
Directory of  C:\Program Files (x86)\Eltima Software\SWF*

3/28/2013   1:35         <DIR>    SWF & FLV Player
                   0 bytes in 0 files and 1 dir
     308,934,520,832 bytes free

[C:\]dir /a: /f "C:\Program Files (x86)\Eltima Software\SWF*"
C:\Program Files (x86)\Eltima Software\SWF & FLV Player

[C:\]

This is being caused by :

setdos /x-5
echo In: %_CWD
setdos /x+5

Is there a simplier way to echo a string that might include the "&" char?
 

Attachments

  • EmailAddr.btm
    1.4 KB · Views: 233
@vince,

But I don't want the " to appear in the output.

Echo %@unquotes["%_CWD"] seems too much for a simple thing.....
 
Here's another way:

Code:
setlocal
setdos /c0xfffe
echo %_cwd
endlocal

The argument to /C should be a character that will never appear in any filename. I picked 0xFFFE because, per the Unicode spec, it's officially Not Even A Character; other values would work.
 
Uhh, NONSENSE from me, SORRY!

Works for "direct" echo commands (messages) ...

Code:
[C:\]echo `test&test`
test&test

but not for functions or variables ...
 

Similar threads

Back
Top