Computing Staff
  • 0

Batch File That Creates Another Batch File?

  • 0

i need to make a batch file that will create another batch file.
not sure how.

Share

1 Answer

  1. Copy/save this as Firstbat.bat then run it.

    @echo off
    cls
    
    echo Now running Firstbat.bat which will create Secondbat.bat then call it.
    echo.&echo.;&echo.;
    (
    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.
    )>%temp%\Secondbat.bat
    
    call %temp%\secondbat.bat
    echo.&echo.;&echo.;
    echo Now returned to Firstbat.bat
    del %temp%\secondbat.bat
    

    Did you Google for an answer before asking the question?

    • 0