For some of you, the thought of DOS probably brings back horrifying memories of things like IRQ conflicts, MSCDEX, the config.sys, himem.sys, etc. Those days are over, but the best aspects of DOS remain a part of Windows, fortunately.
Knowledge of DOS has been critical to my geeky endeavors over the last dozen or so years. Back in the nineties, as the GUI became pervasive and people seemed to have completely forgotten the command-line altogether, I continued to use it for a wide range of tasks. Yes, part of the reason I haven’t “let go” of DOS is in part nostalgic. The other part is that it has in fact been and remains very useful. Especially in troubleshooting and fixing low level problems that can’t be solved any other way.
So, you’re wondering what I could possibly have used DOS to accomplish? These days, for most things DOS can do, there is usually a free or paid application for Windows that does the same thing a little easier. Thing is, knowing how to do various tasks in DOS can help you repair Windows and perform a whole host of other tasks a lot quicker and often more efficiently than installing a bunch of different programs.
As a visual effects artist, I usually render out very large .tga sequences. From time to time, somebody will set the render options incorrectly and I will end up with a bunch of files that are missing an extension. So, if I called the sequence WalkSequence[####], the extension will be missing from some mistake in the render options. I could download a program that will automatically rename large groups of files for me, like the Bulk Rename Utility (direct download, x86, x64); or winautomation which is not freeware. You could also highlight all the files in Explorer and hit F2, rename the first file and then hit enter, however I don’t prefer this method.
What I do, is just use the DOS command REN or RENAME. With any DOS command, to learn the parameters and flags, just type the command and then /? after it. So, for REN, we’d type it like this:
REN /?
So, let’s say I had 1,000 files missing an extension. I’d type REN then the first filename followed by a wildcard (an asterisk in DOS) to indicate anything after then the new filename, and with the addition of the extension you want. DOS would then cycle through every single file matching the properties you defined, which is where the wildcards help. Like this:
REN WalkSequence* WalkSequence*.TGA
…which would turn your filenames into WalkSequence0001.tga and so on — and if you wanted to change .TGA to, say, .JPG, you would type it out like this:
REN WalkSequence*.TGA WalkSequence*.JPG
That’s it. When you type the command in DOS and hit enter, you won’t see any feedback, but the command will work. Some DOS commands issue feedback, some don’t.
XCOPY
Old folks don’t like launching applications like Acronis TrueImage and cwrsync. The XCOPY command has a tremendous amount of flags so it can be daunting to some folks. Don’t worry about it, as with any command, just step through the flags slowly and make it work for what you’re doing. The reason why I mention Acronis TrueImage and cwrsync, is because those are a couple of my favorite backup applications that I frequently use for law firms and computers in the home. Thing is, old folks forget to open seemingly complex programs like TrueImage and having to click buttons. They shut down the computers by accident, ruining my scheduled tasks, etc. So, my solution? XCOPY.
I need something as simple that (1) backs up the computer without any prompts whatsoever to confuse my computer illiterate clients; (2) be executed with a simple double-click; and (3) shuts down the computer when it’s all done.
XCOPY to the rescue. XCOPY allows me to do all of the above using a simple batch script. Let’s say I want to back up the Program Files directory to an external hard drive. The batch script I write would look something like this (E: is the external drive):
ECHO OFF
CLS
VERIFY ON
XCOPY C:\PROGRA~1\*.* /E /I /V /C /F /R /K /X /Y E:\
SHUTDOWN -S -C “Press ANY KEY in the COMMAND LINE WINDOW to ABORT THE SHUT DOWN PROCEDURE. Otherwise: This system WILL SHUT DOWN IN TWO MINUTES.” -T 120 -F
PAUSE
SHUTDOWN -A
Note: On Vista, the hyphen is no longer used and has been replaced with a forward slash. So, instead of SHUTDOWN -A, you’d type SHUTDOWN /A. I don’t know why Microsoft changed this.
Stepping through the flags individually, it isn’t as complex as it looks:
/E -Copies directories and subdirectories, including empty ones.
/I – If destination does not exist and copying more than one file, assumes that destination must be a directory.
/V – Verifies the size of each new file.
/C – Continues copying even if errors occur.
/F – Displays full source and destination file names while copying.
/R – Overwrites read-only files.
/K – Copies attributes. Normal Xcopy will reset read-only attributes.
/X – Copies file audit settings (implies /O).
/Y – Suppresses prompting to confirm you want to overwrite an existing destination file.
Notice how the flags, when combined, allow me to create the perfect execution of settings thereby permitting me to do exactly what I want, without any extra programs or complexities for my clients. All it takes is /?ing the commands to figure out how they work and tailoring them to your specific needs.
In future posts I will outline more specific examples of various commands and how they help me perform seemingly complex tasks in the Windows Recovery Console (such as FIXMBR, DISKPART, etc.) and others.
admin@variableghz.com
cool articel man btu si hrad wehn ur liek doin the c windwos cmd an im liek THSI SI GAYE JSUT GIEV ME SUMTHING 2 CLCK ON LOL bcuz liek dos is old and outd8d if they dint want us 2 click stuf they woodnt make it liek that wuld they lol btu they did so mb its better?????????????????????????? plus what si an ECHO is this a caev lol?????????????? dos is liek a caev bcuz its all black and u cant do shit lol
DOS is the bomb, yo. So is XCOPY.
Some of the DOSish commands I use every day: NET, CD, DIR, ATTRIB, SUBST, that’s all I can think of for now.
It’s all about scripts!
Eg. echo Deleting *.exe from student drive :: Time %time%, %date% :: User %username% >> c:\logs\exe.txt
Also weedlord, I love weed and all but trying to read your post made me more stupid than any weed ever could. lol??????????????