Solved

How to add string to the end of the file in batch scripting

Posted on 2006-10-27
6
533 Views
Last Modified: 2007-12-19
Hello experts,

I need to add string to the file from  batch script. The string is: cmd /c > filename

echo cmd /c > filename >> c:\temp\abcd.txt

But it is failed on symbol >

Please help
0
Comment
Question by:IKeystone
6 Comments
 
LVL 6

Accepted Solution

by:
SCDMETA earned 250 total points
ID: 17822950
Escape the > with a carrat ^

echo cmd /c ^> test >> test.txt
0
 
LVL 15

Expert Comment

by:Raisor
ID: 17822982
Hi,

You might try:

echo cmd /c filename>>c:\temp\abcd.txt


Best regards,
Raisor
0
 
LVL 9

Expert Comment

by:shinobun
ID: 17823942
echo "cmd /c > filename" >> c:\temp\abcd.txt
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 4

Expert Comment

by:chhokra_expert
ID: 17824276
like shinobun said
 echo "cmd /c > filename" >> c:\temp\abcd.txt
will add the test "cmd /c > filename" to the end of the file.

but more importantly, what's that you are trying to do? the output of comand "cmd /c" will be redirected directed to filename but isn't "cmd /c" used to execute a command? i don't see that as part of your string. as it stands, it will probably just add a blank line to your file (whenever that command gets run). is this what you wanted to do?
0
 

Author Comment

by:IKeystone
ID: 17824290
Thanks Raisor.

With symbol ^ everything work fine

0
 

Author Comment

by:IKeystone
ID: 17824292
Sorry, Thanks SCDMETA !!!!!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
A short article about a problem I had getting the GPS LocationListener working.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now