问题
I looked up for answer to my question on many different websites but nothing.
I am creating a batch file which is as follow:
@echo off
md C:\Users\John\Desktop\languages
cd C:\Users\John\Desktop\languages
md italian
md french
md german
md spanish
cd C:\Users\John\Desktop\languages\tedesco
copy con kartofeln.txt
This is the message I want to add into my text file
***CTRL + Z***
how can I now write an executable command "CTRL + Z" in order to close this file and continue my coding?? I want to create this file to then double-click it and execute every line all at once.
回答1:
try this to put your message into a file.
@echo off
****do stuff****
echo This is the message I want to add into my text file >> kartofeln.txt
****do stuff****
the echo command puts text into the stdout stream, which normally goes to the console where you see it, but here we redirect it with the >
so that stdout now points to a file for echo, effectively routing its output into the file. the double >
is so that the output is appended onto the end of the file instead of overwriting its contents. you can do this multiple times, just follow the same format for every line you want sent to your file.
some (in my opinion) great batch tutorials:
http://www.dostips.com/
http://www.dreamincode.net/forums/topic/55203-batch-tutorial-part-1/
http://en.wikibooks.org/wiki/Windows_Batch_Scripting
http://www.didiermorandi.fr/vbscript/doc/Windows_Command_Line_Vic_Laurie.pdf
also, http://www.instructables.com has some good tutorials for beginners.
and, if you have any more questions, you are in the right place, just ask away.
来源:https://stackoverflow.com/questions/24410711/ctrlz-command-in-a-batch-file