batch file that creates another batch file?

December 8, 2010 at 12:06:19
Specs: Windows 7, vaio
i need to make a batch file that will create another batch file.
not sure how.

See More: batch file that creates another batch file?

Report •

December 8, 2010 at 14:04:07
Copy/save this as Firstbat.bat then run it.

@echo off

echo Now running Firstbat.bat which will create Secondbat.bat then call it.
echo echo This is Secondbat.bat which doesn't do a lot as you didn't say what you
echo echo wanted the .bat files to do.

call %temp%\secondbat.bat
echo Now returned to Firstbat.bat
del %temp%\secondbat.bat

Did you Google for an answer before asking the question?

Report •

December 8, 2010 at 14:10:39
i also found that by using line works too

@echo off
echo Hello world >> "new.bat"

unless you already have a file named new.bat it works.

Report •

December 8, 2010 at 15:02:14
That will make a new bat but the new bat won't do much.

Life is too important to be taken seriously.


Report •

Related Solutions

December 9, 2010 at 06:31:59
You will see a command prompt open for 0,2 seconds.

Happy is ONE who says I am an OttoMAN.

Report •

December 9, 2010 at 08:21:44
Yeah, it takes about that much time to set up a Console window, display the output, then close the Console window.

Try the following:

echo Hello world >> "new.bat" 
echo pause >> new.bat

How To Ask Questions The Smart Way

Report •

Ask Question