Is it possible to redirect the output of a batch file inside the script?

前端 未结 2 1866
一整个雨季
一整个雨季 2020-12-19 04:43

I would like to set the standard output of a batch script to go to a file. I would like to do this inside the script if possible.

Note: I do no

2条回答
  •  不知归路
    2020-12-19 05:25

    One way of doing it is the following. Use the call command to execute a label in the script. Edit I realized the first version I posted does not seem to work in a cmd.exe prompt (I was using TCC). The following seems to work in both command processors:

    @echo off
    call :testitout > t.tmp
    goto:eof
    
    :testitout
    echo Hi There
    echo Goodbye
    

提交回复
热议问题