Reputation: 132
I have this in a batch file...
ECHO ActionNumber=0>> %wkdir%\some.ini
...problem is, it never gets written to the file but rather displayed on the console like this...
ActionNumber=
If I had...
ECHO ActionNumber=20>> %wkdir%\some.ini
...it get's written just fine
How can I write a line to this file that is simply "ActionNumber=0" (without quotes, I'm just showing that it needs to be all one line with no spaces, no trailing space either)
Upvotes: 1
Views: 2211
Reputation: 130819
The 0
before the <
makes the parser thinks you are attempting to redirect stdin. Probably the simplest solution is to move the redirection as Peter Wright has done. Another option is to enclose the command in parentheses.
(ECHO ActionNumber=0)>> %wkdir%\some.ini
Upvotes: 4
Reputation: 65486
Use a Space after the 0
ECHO ActionNumber=0 >> %wkdir%\so
Edit: Thanks to @Christian K
0>> redirects to the Console stdin (stdout is 1 and stderr is 2)
Upvotes: 0
Reputation: 79983
>>%wkdir%\some.ini ECHO ActionNumber=20
Unfortunately, the space-after-digit solution echoes the space into the file, so you have trailing spaces.
(That's a gotcha with any digit immediately preceding a redirector)
Upvotes: 6