Search code examples
windowscmdsubroutine

Cmd windows >> log.bat


I'm trying to send the subroutine command with which it will subroutine that will create a log!

version of my code

echo echo del %%file%% >subroutine.bat >temp.bat 

this part "echo del %file% >subroutine.bat" to be stored in the subroutine

Do you have a solution?


Solution

  • If you want echo del %%file%% >subroutine.bat to be stored in a file temp.bat then

    echo echo del %%file%% ^>subroutine.bat >temp.bat 
    

    will do the job. The caret (^) turns off the special meaning of the redirector > so that it is echoed literally. You can do this with any character having a special meaning to cmd &^!<>| except %. To echo a % you need to double the % thus: echo %%