usering ^ for echo

December 18, 2010 at 16:19:51
Specs: Windows XP
am I typing the echo command right?
I used the "^" character in front of characters that are restricted in command
is that right
here is my code

set _aaa=0
set __path=.\zone5\
for /f %%A in ('dir /b/o:n %__path%*.cmd') do (
echo ^:^:Writer: J Lee Hughes>%__path%%%A
echo ^:^:file: %%A>>%__path%%%A
echo ^:^:%data%>>%__path%%%A
echo ^:^:==set=======================>>%__path%%%A
echo ^set ^_answer_%=0>>%__path%%%A
echo ^set ^_answer_^=^%^~dp0>>%__path%%%A

echo ^:^:==for=======================>>%__path%%%A
echo ^:^:==exit=======================>>%__path%%%A
echo ^echo ^%^_answer^_^%>>%__path%%%A
)

the set ones are not working and the echo echo is not working write
thanks


See More: usering ^ for echo

Report •


#1
December 18, 2010 at 18:22:27
Colons, tildes, underscores, and percent symbols don't need to be escaped, neither do individual commands.

Only carets, ampersands, brackets, pipes, and redirection characters as far as I know need to be escaped.

Can I put a question here?


Report •

#2
December 18, 2010 at 20:03:48
the under underscores need to go to the echo to file
I need to set some other cmd file up
it is the same ex for name of file
so in the end I need

::J Lee Hughes
::file [the file name]
::=set=====================
set _answer_=0
::=get-next-file===========


::=exit=========
echo %_answer_%


Report •

#3
December 19, 2010 at 08:48:02
SETLOCAL EnableDelayedExpansion

set _aaa=0
set __path=.\zone5\
for /f %%A in ('dir /b/o:n %__path%*.cmd') do (
echo ::Writer: J Lee Hughes>%__path%%%A
echo ::file: %%A>>%__path%%%A
echo ::%%data%%>>%__path%%%A
echo ::==set=======================>>%__path%%%A
echo set _answer_=0>>%__path%%%A
echo set _answer_=%%~dp0>>%__path%%%A
echo ::==for=======================>>%__path%%%A
echo ::==exit=======================>>%__path%%%A
echo echo %%_answer_%%>>%__path%%%A
)

However, this line here:

echo set _answer_=%%~dp0>>%__path%%%A

Isn't going to do anything, as you do not use the variable "%%0"

Can I put a question here?


Report •

Related Solutions


Ask Question