Solved

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

Posted on 2006-10-27
6
534 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

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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 …

832 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