Command Line Interface (CLI) tools often get the job done much faster than navigating through a GUI. CLI tools can also generate a lot of information. Some tools can generate more information than can be viewed in a CLI window. Here is a batch that will take the output of any CLI expression, command or tool, along with up to eight parameters and present it temporarily in Notepad.
::Usage command [command parameters]
REM This script captures the output of any commandline utility
REM that writes the console and sends it to Notepad
REM if no command is specified, don’t do anythingREM and go to the end of the script.
if %1$==$ GoTo :EOF
REM Specify the temp file variable
echo Calling %1 %2 %3 %4 %5 %6 %7 %8 %9
Call %1 %2 %3 %4 %5 %6 %7 %8 %9 > %tmpFile% && start notepad
%tmpFile% && del %tmpFile%
REM Clear the temp file variable
Put the batch file in your Windows directory or some directory in your path. To use the file, type this at a CLI prompt:
Guify ipconfig /displaydns
to show the DNS entries cached locally. The batch file redirects the command output to a temporary text file. Then it opens the text file in Notepad. Once Notepad is closed, the temp file is deleted. You can copy and paste the information in Notepad to another file or use SaveAs.
The tool works for most CLI commands but is not 100-percent foolproof. There are some commands and utilities that can’t be redirected. For example, something like “netstat /? > test.txt” will fail, which means “guify.bat” will also fail. But a command line “guify netstat -an” will work.