Clone wiki

codetrainer / Redirecting to file

In codetrainer project we make use of windows batch files (.bat) on windows platform. This is needed in order to automate some repetitive commands that don't require any input from the user (non-interactive commands). More information about streams and redirecting them to file can be found at the following links:

In our particular case to redirect the output of the buildall.bat we need to do the following:

  • Open a command prompt (Start-Run / WindowsButton +R, type cmd.exe as command and press Enter/OK)
  • Go to the directory where buildall.bat is found with the cd command in the command prompt.
    • The command is cd c:\code\codetrainer\scripts\windows for the examples from this wiki
  • Redirect the output of buildall.bat
    • The command is the following: buildall.bat > log.txt 2>&1
    • Mind that log.txt is just a file name, you can choose whatever file name you want.

When having errors you can check the log.txt file more carefully than inspecting the command prompt.

NOTE: For unix users of codetrainer redirection can be done in the same way: ./ > log.txt 2>&1