DOS Command Line Stuff Worth Remembering
This is an ongoing collection of dos command line tips and tricks I've run across over the years. I tend to forget what I did 5 min ago, let alone a bunch of DOS commands, so I'm collecting the stuff I've found here as a place of reference. Much of what you will find here is probably posted on the internet somewhere (which is where I got it from) or, I've created a few little tricks myself to help me along the way.
Append to New File - This will create OR overwrite the existing file.
dos-program.exe > file.txtAppend to Existing File - This will create OR add to any existing file.
dos-program.exe >> file.txtScript to add carriage returns to appended file
Note: the following script will overwrite the existing file each time it is run...
@echo off
echo Run the fancy program and output to file!
dos-program.exe > file.txt
echo. >> file.txt
echo. >> file.txt
dos-program2.exe >> file.txtget Computer Name Environment Variable
echo %computername%Environment Variable Heaven
http://en.wikipedia.org/wiki/Environment_variable
Execute DOS Command Scripts / Bat files from UNC Network path - This will automatically map the last available drive letter to the UNC path you currently reside in. Let's say you are in \\computer\folder\test This will automatically map Z:\ to the test folder for you.
@echo off
cls
pushd %~dp0
echo Do Something cool!
popdAppend the Current Time to a File
net time \\%computername% |find "time" > "file.txt"This will output in the following format:
Current time at \\THISCOMPUTER is 7/26/2010 10:28 AM
The Wichita Computer Guy is hosted by one of the best hosting companies on the market: Hostgator.com. Not only do they provide unlimited domain addons, subdomains and parked domains, they also offer unlimited databases, unlimited hosting space and unlimited bandwidth! We have been using Hostgator for several years now and had great customer service support and almost 100% uptime. If you are looking for a website hosting company that provides everything you need for a powerful CMS based website, take a look at Hostgator.com!!
