View Full Version : Making a file using Batch Files
How do i create a .txt file using a batch file with something written on it.
For example, i want to write this:-
i>>n;
i<<n;
a
b
c...
It has multiple lines and '>', so echo (text) >> test.txt doesnt work.
Is there a better way?
NascentOxygen
Feb12-12, 04:00 PM
I assume some sort of Microsoft operating system, though you haven't indicated which.
You might get some ideas here. http://www.netikka.net/tsneti/info/tscmd047.htm
NascentOxygen
Feb12-12, 05:47 PM
Depending on the complexity of your task, it may be sufficient to use this technique:
It's usually enough to enclose it between two %%"%% blocks, like this:
echo %%"%% something ii >>newfile %%"%% >reg.bat
It may not look pretty but it usually works just fine.
If %%"%% doesn't seem to do what you want, try single percents like this:
echo %"% something ii >>newfile %"% >reg.bat
I no longer have a MSDOS system to try stuff out. You are likely to discover there are other characters that cause you problems when you try to echo them to a second file, too.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.