I have a problem, I want to write a .bat file that doesn't exist with another .bat file. For example i want to create the .bat file
@echo off
echo Hello world!
pause
But this file does not exist but is created at the end of the running another .bat file
It's possible?
(Excuse for bad english but I'm italian)
You would echo the commands to the new .bat file. >
directs the output to a new file (or overwrites the file if it exists already) and >>
appends the output to a file.
echo ^@echo off > newFile.bat
echo echo Hello world! >> newFile.bat
echo pause >> newFile.bat
Of course, that would overwrite the file everytime your batch script is ran, so you may want to precede this with if NOT EXIST newFile.bat (
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.