Solved

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

Posted on 2006-10-27
6
542 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Simple Linear Regression

707 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