Search This Blog

Tuesday, January 15, 2013

About the DOS command line

Yes there is now powershell, but if you have a Unix/Linux background it is hard to become motivated about another command line interface from Microsoft.

Having said that you can do some useful things with the MS Dos command line interface, many of them revolve around the find command.

Another useful tool is xcopy, which is good, but for me lacks one feature in particular; Pixelabs have the excellent xxcopy - which is a drop in replacement for xcopy.
The feature I wanted is to only copy files that are not on the destination.
To do this issue xxcopy with the /bb option:
c:\tools\xxcopy.exe l:\CZK01 t:\CZK01 /s /i /bb
The others are
/s Copies directories and subdirectories except empty ones.(or can use /e)
/i Create destination if it doesn't exist as a directory.

If you use xxcopy please purchase it, note that I don't think they have a Unix background -
Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new features.

Checking Error codes:

Always good to check the return code of a previous command before renameing, editing files:

c:
cd c:\datafilepath
if ERRORLEVEL 1 goto end
:rename
echo cd to c:\
datafilepath ok
rem do operations here
:end

Just Listing Directories:

dir /a:d  /s /b

C:\Temp\COMPAQ\NIC\PROSETDX
C:\Temp\COMPAQ\NIC\PROSETDX\DRIVERS
C:\Temp\COMPAQ\ProtectTools\BIOS_Configuration
C:\Temp\COMPAQ\ProtectTools\Device_Access_Mgr





No comments:

Post a Comment