DOS Survival Guide

(under construction)

Resources (URL's)

Dos (Window vs Full Screen)

Survival Guide Notes

Topic Notes
Install Errors If you get the error below when you are installing a program follow the solution:
"Error:  config.nt.  The system file is not suitable for running MS-DOS and Microsoft Windows applications"

Solution:

  • Control Panel, System, Advanced, Environment Variables
    Remove all spaces from any Tmp (or Temp) variable.
    (ie:  c:\temp will work if you make sure the directory exists.)
Environment Environment from DOS prompt
  • Spaces in directory or file names.
    Use quotes (" ") when referring to dir/files with spaces:  "Program Files"
  • Displays the content of the environment variable named "path".
    c:\> set path
  • Sets the path variable.
    c:\> set path = "c:\jdk1.3.0\bin"

Environment from Batch files.

  • You can reference the value of a environment variable by using
    %<envrionment name>% (ie: %path%).
  • Appends path info to the end of the path variable
    set path=%path%;c:\jdk1.3.0\bin; c:\mydirectory

 

command.com Command.com
  • Creating a new command shell with an environment size of 4096 and call a batch file test.bat.
    • command /e:4096 /c call test.bat
Command Prompt Command prompt
  • Go to a DOS command prompt:
    Start, Run, cmd.exe [enter]  (For Win 2000, XP and above)
  • To cut-n-paste to and from a DOS command line.
    Right click in the top title bar of the DOS window.
    Choose Edit.
    (Now play with Mark, Copy, Paste.  Works a little strangely at first!)
Help on DOS commands Help on DOS Commands
  • help <DOS Command>
    Ex: 
    help xcopy
    help del
     
Creating a text file Creating text files (logs, etc...)
  • > - redirects output to a new file.
    >> - appends redirected output to a file.  Creates one if it doesn't exist.
  • echo off
    echo ************** >> logfile.txt
    echo Start process >> logfile.txt
    echo ************** >> logfile.txt
    date /T >> logfile.txt
    time /T >> logfile.txt
    dir *.* >> logfile.txt
    echo ************** >> logfile.txt
    echo Finished >> logfile.txt
    echo ************** >> logfile.txt
DOS Scheduler AT - the dos command.
See my other web page: Windows-Auto Services
DOS Task Scheduler, etc...
Accessing other Computer Accessing other Computers
  • If you have security access:
    dir \\<computername>\<directory name>
  •  
DOS Batch & Parms Passing parms to a batch file:

The example below shows how you can pass a parameter to a batch file and then access it.

Step #1:
mydos_batchfile_parms.bat - create this file with the following content:
call mydos_batchfile_parms_called.bat ParmEx1 ParmEx2 ParmEx3
pause

Step #2
mydos_batchfile_parms_called.bat - create this file with the following content:
echo off
echo Parms passed: %1 %2 %3
echo Parm 0: %0
echo Parm 1: %1
echo Parm 2: %2
echo Parm 3: %3
echo on

Step #3
Run the batch file: mydos_batchfile_parms.bat

Results to the DOS Screen:
Parms passed: ParmEx1 ParmEx2 "ParmEx3 Multiple Words"
Parm 0: mydos_batchfile_parms_called.bat
Parm 1: ParmEx1
Parm 2: ParmEx2
Parm 3: "ParmEx3 Multiple Words"
 

Custom Logs & theEvent Viewer Custom Logs & the Event Viewer
  • Create a Custom Log
    Win XP: Start, Control Panel, Administrative Tools, Event Viewer
    • To create a new log view, click "Action", "New Log View" and then specify the name.
      For example:  Custom Logs
  • Note: You cannot write a custom event to the Security log.
  • Creating an Event via DOS
    • Command: eventcreate /l LogName /so EventSource /t EventType /id EventID /d EventDescr
    • EventID - 1 to 1000.
Launch IE from a Batch File Example Batch File - this one also creates a log file.

set strLogFile=MyTextFileA_batchfile_run_asp_via_ie.log
echo ************************************ >> %strLogFile%
echo Start: %date% %time% >> %strLogFile%
"C:\Program Files\Internet Explorer\IExplore.exe" http://www.google.com
echo Stop: %date% %time% >> %strLogFile%
 
Creating a Log File of when a batch file runs. Log Files Create from a Batch file.

rem: Warning: If run from a Windows Scheduled Task you must provide full path for filenames or CD to the path as seen below!
c:
cd "C:\_data\webs\A\michael-thomas.com\tech\dos"
set strLogFile=mydos_createlogfile.log
echo ************************************ >> %strLogFile%
echo Start: %date% %time% >> %strLogFile%
echo Run program here.... >> %strLogFile%
echo Stop: %date% %time% >> %strLogFile%
pause
 

net use net use & net use /DELETE

Examples:
net use <driveletter>: \\<ipaddress>\<pathname> /Persistent:no
net use <dirveleter>: /DELETE - removes the mapped drive

 

net share net share

net share <sharename>="<drive>:\<pathname>"

 

net user net user

net user <userid> <pswd>

WinZip Command line I think you need a purchased copy (not the free one)
call "C:\Program Files\WinZip\WZZIP.EXE" -rp "<pathfilename>.zip" 
  "<pathfilename zip these>\*.*" /q