Computing.Net > Forums > Programming > Batch exporting problems

Batch exporting problems

Reply to Message Icon

Original Message
Name: hobblyhoy
Date: July 2, 2007 at 19:07:47 Pacific
Subject: Batch exporting problems
OS: winxp
CPU/Ram: 512
Model/Manufacturer: hp
Comment:

I have file A.bat:

echo %%y > test.txt

however after it is ran test.txt contains only "%y"

Why does it keep omiting my second percent sign? and more importantly how do I stop it?

"the right to swing my arm ends where your nose begins."
-Claude Adrien Helvetius


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: July 3, 2007 at 03:50:11 Pacific
Reply: (edit)

Within a bat, one % is always 'stripped'.

What are you trying to do?


=====================================
If at first you don't succeed, you're about average.

M2



Report Offensive Follow Up For Removal

Response Number 2
Name: IVO
Date: July 3, 2007 at 06:18:03 Pacific
Reply: (edit)

Echo %%%%y > test.txt

i.e. you have to double each % symbol as M2 pointed out. Better however you explain what you are trying to achieve to avoid waste of time and misunderstanding.


Report Offensive Follow Up For Removal

Response Number 3
Name: hobblyhoy
Date: July 3, 2007 at 12:30:33 Pacific
Reply: (edit)

ahh, wow, I feel stupid. instead of thinking 2 to 1, I was thinking subtract one, so I tried:

echo %%%y > test.txt

and it did the same thing, I assumed it would continue in this fasion. But it doesnt. Thank you Ivo!

"the right to swing my arm ends where your nose begins."
-Claude Adrien Helvetius


Report Offensive Follow Up For Removal

Response Number 4
Name: tonysathre
Date: July 3, 2007 at 21:13:40 Pacific
Reply: (edit)

You can also use the ^ (caret) symbol as an escape character.


Report Offensive Follow Up For Removal

Response Number 5
Name: hobblyhoy
Date: July 3, 2007 at 21:29:30 Pacific
Reply: (edit)

^how might that help me mate?

"the right to swing my arm ends where your nose begins."
-Claude Adrien Helvetius


Report Offensive Follow Up For Removal


Response Number 6
Name: Razor2.3
Date: July 5, 2007 at 18:58:51 Pacific
Reply: (edit)

It gives you a second option:
echo %%%%y > test.txt
or
echo ^%^%y > test.txt


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch exporting problems

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge