Sign in to follow this  
Followers 0
saluum

Add line to a batch file from command prompt

4 posts in this topic

Hello Forum, 

I want to create a program which allows to add lines to an existing batch file. This should work within the Windows command prompt. I want to run it like this: 

myprogram.exe "C:\Program Files\MyPath\MyBatch.bat" "This is the line to be added to the batch-file. It should be allowed to use " ' should be allowed!"

I couldn't find out so far how to get this working. What also could be helpful if ther is a function which creates a batch file from the command prompt...

Thanks, s

Share this post


Link to post
Share on other sites



While you could easily write this in an autoit script, you may not need it in the first place:

Quote

C:\tmp>echo Hi, I am "a" 'sentence'. Using one ^> symbol creates new file. > file.txt

C:\tmp>echo The caret escapes special characters. Using two ^> symbols APPENDS to the file. >> file.txt

C:\tmp>type file.txt
Hi, I am "a" 'sentence'. Using one > symbol creates new file.
The caret escapes special characters. Using two > symbols APPENDS to the file.

 If you want to write or append to a file from within AutoIt, check the helpfile and examples for FileOpen, FileWrite, FileWriteLine and many other related functions.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Thanks - this works fine for me. :)

Share this post


Link to post
Share on other sites

No problem :dance:


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0