workstation

Command Line Usage

  1. Basic File Management

    1. Replace Active File using mv (from the Resource Kit).

        mv /x /d {full path to THIS.DLL} {full patch to THAT.DLL} replaces, at next boot, the active file THAT.DLL with the [new] file THIS.DLL.

    2. Rename using ren or rename

        ren this.txt that.txt renames "this.txt" in current directory to "that.txt".

        ren *.html *.txt changes extensions of all HTML files (in current directory) to "txt".

        FOR /r %a IN *.html DO ren "%a" *.txt changes extensions of all HTML files recursively (across subdirectories) to "txt".

        mv /x /d {full path to THIS.DLL} {full patch to THAT.DLL} replaces, at next boot, the active file THAT.DLL with the [new] file THIS.DLL.

    3. Delete using del or rmdir

        del this.doc deletes "this.doc" in current directory.

        del *.doc deletes all DOC files in current directory.

        del \*.txt \*.doc /s /q /f >nul 2>&1 deletes all TXT and DOC files recursively (across subdirectories) without nagging prompts.

  2. Parsing Files for String

      FOR /r %a IN (*.txt) DO findstr thisstring "%a" searches folders recursively for a TXT file containing "thisstring".

        To use the FOR command in a batch file, you have to use two percent signs in front of the variables.

        Using quotes around the final variable enables command to work with long file names.

Buy it now from Amazon!

Published in April 1998, Windows NT Shell Scripting, by Tim Hill, is the only book which covers both the basic NT commands, including the undocumented ones and/or switches, and shell scripting under Windows NT.


Further Resources:

Newsgroups: