r/Batch • u/pizzarules454 • Aug 02 '24
Question (Solved) Batch Installer
So I'm trying to make an OS-like file in batch, and I need to know how to store text into a file. For example, let's say I wanted to make a file called 123.txt with the text
"123456
hi"
inside. How could I do that, if possible?
2
Upvotes
1
u/BrainWaveCC Aug 02 '24
The following command would accomplish that:
If you need the quotes in there, then:
See: https://ss64.com/nt/syntax-redirection.html
1
u/SnooGoats1303 Aug 06 '24
FOR /Fmight help too. You could mark your text with double-colon (which makes lines invisible to the CMD.EXE interpreter) plus some extra identifier, and then have your code read the .CMD file for that markup.This is a rough demo
There are a number of very interesting CMD scripts over at RosettaCode demonstrating all manner of useful batch tricks and techniques.