logo_michael-thomas.jpg (3143 bytes)

DOS Survival Guide

(under construction)

Resources (URL's)

bullet

www.easydos.com - Helpful info on DOS commands.

bullet

www.computerhope.com/msdos.htm - Helpful info on DOS commands.

Dos (Window vs Full Screen)

bullet

If you set the property to full screen you can get back to a DOS window with "Ctrl-Enter".  To see the DOS window properties right click on the DOS windows title bar and choose "properties".

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:

bulletControl 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
bulletSpaces in directory or file names.
Use quotes (" ") when referring to dir/files with spaces:  "Program Files"
bulletDisplays the content of the environment variable named "path".
c:\> set path
bulletSets the path variable.
c:\> set path = "c:\jdk1.3.0\bin"

Environment from Batch files.

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

 

command.com Command.com
bulletCreating a new command shell with an environment size of 4096 and call a batch file test.bat.
bulletcommand /e:4096 /c call test.bat
Command Prompt Command prompt
bulletGo to a DOS command prompt:
Start, Run, cmd.exe [enter]  (For Win 2000, XP and above)
bulletTo 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
bullethelp <DOS Command>
Ex: 
help xcopy
help del
 
Creating a text file Creating text files (logs, etc...)
bullet> - redirects output to a new file.
>> - appends redirected output to a file.  Creates one if it doesn't exist.
bulletecho 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
bulletIf you have security access:
dir \\<computername>\<directory name>
bullet 
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
bulletCreate a Custom Log
Win XP: Start, Control Panel, Administrative Tools, Event Viewer
bulletTo create a new log view, click "Action", "New Log View" and then specify the name.
For example:  Custom Logs
bulletNote: You cannot write a custom event to the Security log.
bulletCreating an Event via DOS
bulletCommand: eventcreate /l LogName /so EventSource /t EventType /id EventID /d EventDescr
bulletEventID - 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