avatar

Andres Jaimes

How to redirect stdout / stderr to a file

Redirecting all your program output to a file is very simple and can be accomplished like this: myapp > output.log This line will send all the output generated by myapp to a file named output.log. The contents of output.log will always be overwritten; but you can use a second > to append to the current content like this: myapp >> output.log As well as with output, it is very useful to redirect the stderr (standard error output) to a file rather than to the screen.

How to manage local or remote services from command line

Starting or stopping services on Windows is a task commonly performed by using the Services snap-in on the MMC console. From time to time you want to perform such tasks from the command line. A possible reason for this is when you are creating scripts (batch files). To achieve this, you have two options: net for managing local services and sc.exe for remote ones. The net command is included in your default Windows installation.