Is it possible for a batch file (EXAMPLE1.bat) to create another batch file (EXAMPLE2.bat) already programmed? Where I determine the programming of EXAMPLE2.bat within EXAMPLE1.bat.
Is it possible for a batch file (EXAMPLE1.bat) to create another batch file (EXAMPLE2.bat) already programmed? Where I determine the programming of EXAMPLE2.bat within EXAMPLE1.bat.
Yes, just put the commands after echo
and use the >
symbol to specify the name of the file you want to create.
You can specify any extension, the content will always be written in plain text.
Using only a >
symbol, the command will overwrite the contents of the file specified below.
Using two symbols >>
the command adds a line to the end of the file specified below. You should use this if you are to write more than one command in the same file.
This command below creates another file with the open notepad command:
@echo off
echo START NOTEPAD.EXE >> abre_notepad.bat
echo Arquivo criado.
pause > nul