Writing single digit numbers to a text file -


i have code

rem saved in d:\temp\writetext.bat @echo off @echo -attedit> atteditchangename.txt @echo y>> atteditchangename.txt @echo 36x24bdr>> atteditchangename.txt @echo subtitle>> atteditchangename.txt @echo b209 11.5 ton bridge elec layout 1 ^& 2>> atteditchangename.txt @echo 612.9014,43.8533>> atteditchangename.txt @echo 618.5063,35.8628>> atteditchangename.txt @echo 109.9409,-6.7209>> atteditchangename.txt @echo.>> atteditchangename.txt @echo v>> atteditchangename.txt @echo c>> atteditchangename.txt @echo b209>> atteditchangename.txt @echo b211>> atteditchangename.txt @echo next>> atteditchangename.txt  pause 

that creates text file , fills text. problem line intended write text "b209 11.5 ton bridge elec layout 1 & 2" not writing. instead, gets fed on screen.

see link screenshot http://gyazo.com/a97e6daaf4695b766659df426180c95b

we troubleshooted problem as , found this happens when number single digit , both preceded , followed space.

for example:

  • "1a" work

  • "11" work

  • "1." work

  • " 1 " not work

it requirement text read " 1 & 2" verbatim. can achieve this?

instead of specifying each echo should go on every line
(i.e @echo -attedit> atteditchangename.txt) , use method of block form. solve issue you've been having , clean code bit.

@echo off  > atteditchangename.txt ( @echo -attedit @echo y @echo 36x24bdr @echo subtitle @echo b209 11.5 ton bridge elec layout 1 ^& 2 @echo 612.9014,43.8533 @echo 618.5063,35.8628 @echo 109.9409,-6.7209 @echo. @echo v @echo c @echo b209 @echo b211 @echo next )     pause 

using > atteditchangename.txt (as did in example) override current contents of file, , replace in (). if wish simple add text file, use >> atteditchangename.txt.

while i'm unsure why issue arises, above code format solve problem , print of text text file.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -