|
Answer» Hello. For example, I have this code:
Code: [Select]echo Some bump variable is: %somedumpvariable% >somedumptextfile.txt But how do I have it write seperate lines? Like:
Some bump variable is: %somedumpvariable%
or something like that.
Note: I need it to work on Windows XP SP3.To write SEPARATE lines you would have to do:
Code: [Select]echo Some bump variable is: > somedumptextfile.txt echo %somedumpvariable% >> somedumptextfile.txt
When you have >> it adds information to an existing file where as > creates a new file. But I think you already knew that. THANK you, that worked fine Quote from: BatchFileCommand on February 17, 2009, 06:20:37 AM To write separate lines you would have to do:
Code: [Select]echo Some bump variable is: > somedumptextfile.txt echo %somedumpvariable% >> somedumptextfile.txt
When you have >> it adds information to an existing file where as > creates a new file. But I think you already knew that.
I disagree, >> can make files too. But, that's right.Quote from: BatchRocks on February 17, 2009, 08:59:45 AMQuote from: BatchFileCommand on February 17, 2009, 06:20:37 AMTo write separate lines you would have to do:
Code: [Select]echo Some bump variable is: > somedumptextfile.txt echo %somedumpvariable% >> somedumptextfile.txt
When you have >> it adds information to an existing file where as > creates a new file. But I think you already knew that.
I disagree, >> can make files too. But, that's right.
Actually, BFC is correct. > will ALWAYS create a new file- if a file with that NAME EXISTS it is truncated to 0 bytes. >> will always append to the file if it exists, creating a new one of necessary.Sorry, apologies.on the other hand as you say >> will create a file as necessary. But in this CASE that file might balloon to huge sizes, depending of course on how often this batch is run.
|