This section covers tips and tricks which affect command line sessions.
To paste text after a copy/mark operation without a final carriage return, hold down the Shift key while choosing Paste from the pull-down menu.
In order to remove the files from the Delete subdirectory of a drive to regain some drive space, type the following at a command line:
UNDELETE <drive>:\* /f /s /a
where <drive> is the letter of the drive which contains the Delete subdirectory you wish to clear.
Related subject(s):
To search for a particular file name on a drive, type
DIR <drive>:\<file spec> /S
where
<drive> is the letter of the drive you wish to search
<file spec> is the specification of the file you are searching; standard wild cards can be used.
To make all command line windows open maximized, hold the Shift key while clicking on the maximize button.
Note: the above procedure causes anomalous behavior (the window opens in the upper left hand corner, then repositions itself in the middle of the screen) under the 2.11 CSD. To fix this problem, hold the Shift key while clicking on the restore button in the uppermost right hand corner of the command line window.
In some cases, you additionally may have to hold the Shift key while using the mouse to resize the window to its fullest size by dragging the bottom right corner.
Related subject(s):
Screenshot: Command window with mouse pointer on Maximize button.
from Tim Sipples' FAQ
To create a small scroll-back buffer for your command line sessions, type
MODE 80,102
Related subject(s):
To use OS/2 without loading the Workplace Shell, replace the following line in your CONFIG.SYS
SET RUNWORKPLACE=<drive>:\OS2\PMSHELL.EXE
with
SET RUNWORKPLACE=<drive>:\OS2\CMD.EXE
where <drive> is the letter of the drive on which OS/2 is located.
Note that you can always invoke the Workplace Shell by typing PMSHELL at an OS/2 command line. It can consequently be removed by closing it from the Window List.
Related subject(s):
Tricks for speeding up text display.
Related subject(s):
Fonts which are 8 pixels wide generally display faster than those which are not 8 pixels wide. Choose Font Size from the pull-down menu, then choose a "x 8" type of font size.
Screenshot: Font Size dialog box with 14x8 font size highlighted.
Text scrolling speed can also be enhanced using the Video_ROM_Emulation setting.
Screenshot: DOS Settings dialog with Video_ROM_Emulation highlighted.
You can add entries to your PATH "on the fly" by using:
PATH %PATH%;<drive>:\<path>
where
<drive> is the drive on which the subdirectory you want to add is located
<path> is the path you want to add
Note: This also works for DPATH
If you have Undelete activated (via SET DELDIR in your CONFIG.SYS), but want to delete a file or files so they can't be undeleted, use:
DEL <file(s)> /F
where <file(s)> is the file specification of the file(s) you want to delete
Related subject(s):
If you are using batch files (*.CMD) which do not have ECHO OFF statements, you can also suppress the echo by using the /Q switch:
Example: BATCH.CMD /Q
contributed by Jack Tan
Supplement your command line usage by stacking commands with &&, &, ||, and ():
e.g., RunMe.EXE && RunMeIfFormerSucceeds.EXE
e.g., RunMe.EXE || RunMeIfTheFormerDidntSucceed.EXE
e.g., If.EXE && Then.EXE || Else.EXE(Else.EXE doesn't run if and only if both If.EXE and Then.EXE run successfully)
e.g., RunMe.EXE & AndMeToo.EXE
e.g., DETACH (FORMAT a: /once /v:"hi" && XCOPY c:\x A: /S) & UNZIP file.zip(the commands in parentheses are operated on by DETACH, then UNZIP executes)
inspired by a code snippet by Dick Goran
You can check the status of a drive, e.g., if a floppy is inserted into a floppy drive or not with a REXX script, CHKDRIVE.CMD
The routines in CHKDRIVE.CMD can be incorporated into longer REXX scripts whenever the status of a drive needs to be ascertained.
Other REXX scripts:
by David Matocha
You can shutdown your system with a countdown using SHUTDOWN.CMD combined with a scheduling utility and a automatic power-down of the system.
Related subject(s):
Unlike DOS, OS/2's command line allows you to use multiple arguments at the command line for the DEL and DIR commands.
e.g., DEL <file1> <file2> <file3> DIR <file1> <file2> <file3>
where <file1>, <file2>, and <file3> are different filenames (with any appropriate wildcards).
contributed by Jack Tan
Use the Enhanced Editor (EPM) command SHELL to produce a command line with the following attributes:
Unfortunately, programs which take control of the screen (like screen-based editors) won't run.
Screenshot: EPM command shell, using the Helvetica font.
contributed by Jack Tan
The 'Working Directory' entry in the settings notebook also applies to command lines, such as 'OS/2 Window' and 'DOS Full Screen.' In these cases, the working directory becomes the starting directory.
You can format a diskette in the background from the command line or in a batch file without user intervention with the line:
DETACH FORMAT <drive>: /ONCE /V:<label>
where <drive> is the drive of the diskette you wish to format, and <label> is the name you wish to use for the volume label.
contributed by Guy Gerard Lemieux
You can save the size of any window permanently by holding the Shift key while resizing.
Related subject(s):
The REXX script SLEEP.CMD will create a pause for a specified length of time.
Other REXX scripts:
The REPLACE command will only copy files of the same name from the source to the target:
REPLACE <source> <target>
where <source> is the drive, path, and file specification of the files you want copied; and, <target> is the drive and path to which you want the files copied.
However, when REPLACE is used with certain command line switches, it becomes even more useful.
Have you ever wished you could only copy files which don't already exist on the target drive? Try:
REPLACE <source> <target> /A
Have you wanted to copy only files which have been updated? Try:
REPLACE <source> <target> /U
You can "touch," i.e., change to current date and time, a file or set of files using a form of the COPY command:
COPY <filespec> /b + ,,
where <filespec> is any valid filename or OS/2 file specification
When adding OS/2 or DOS command line sessions to the desktop's popup menu, prevent the object from passing the desktop's path by putting a percent sign (%) in the Parameters field on the Program page of the command line object's Settings notebook.
Related subject(s):
Screenshot: Placing a percent sign in the Parameters field.
Screenshot: Desktop Settings notebook with Create New Window highlighted.
In order to be able to open multiple command line sessions from a command line object that you added to the desktop's popup menu, you must alter the desktop's settings, not those of the command line object:
Note: changing the Object Open Behavior for the desktop may have unexpected results when opening other objects from the desktop.
Related subject(s):
contributed by L. Kuru
EVAL.CMD is a REXX script for a simple, yet powerful command line calculator.
Several arithmetic functions are available:
e.g., EVAL (2+3)**2
e.g., EVAL 12.345567e14*1e-50
e.g., set pi=3.1415926 set radius=3 EVAL %pi%*%radius%**2
Other REXX scripts:
contributed by Xavier Caballe
You can start a DOS session with the maximum free memory using BIGDOS.CMD.
Note: if using OS/2 2.1, you may have to change RMSIZE=640 to RMSIZE=639 in your CONFIG.SYS file in order to get this to work.
Other REXX scripts:
contributed by Jack Tan
Use the START command in a fullscreen session to avoid the dreaded clock pointer and continue working at the command line when loading certain queue-hogging applications.
e.g, at a fullscreen OS/2 prompt:
START /b 123G.EXE
contributed by Peder Madsen
Tired of the dreaded black-and-white OS/2 command prompt? Create more colorful prompts with the PROMPT command. Try:
set prompt=$E[37;44m[$P]
which gives you white text on blue background.
Instead of 37 you can use any number between 30 and 37 to control the foreground color, and instead of 44 you can use any number between 40 and 47 to control the background color.
You can also use the PROMPT command in your CONFIG.SYS file to start each OS/2 command session with your favorite colors.
Note: ANSI must be turned on (this is the default).
contributed by Hugo Jimenez-Vazquez
To copy fullscreen text to the OS/2 Clipboard:
contributed by Jack Tan
To list custom DOS settings (i.e., the settings which have been changed from the default) at the command line:
Screenshot: Use asterisk as first character in "Path and File Name" box.
Screenshot: List of custom DOS settings (with cute cat pointer!).
contributed by Michael Prager
// Many of us have wished for a scrolling command window, as supplied in many graphical versions of Unix. This is how to get one. At an OS/2 command line, type:
PMREXX REXXTRY.CMD
This gives a scrolling Rexx window that executes Rexx commands interactively. Since Rexx passes through all OS/2 commands, it can be used for executing OS/2 commands. Just don't forget that many OS/2 commands will need to be enclosed in quotation marks. //
Related subjects:
contributed by Jack Tan
// To switch temporarily to a different directory when at an OS/2 command line, type CMD.EXE at the command line. Switch to the directory you want, and when you are finished in that directory, simply type EXIT at the prompt. You will be back in your original directory. //
contributed by Jack Tan
// You can use command line switches to cancel print jobs from the OS/2 command line:
PRINT /C
will cancel the current print job on the default printing device.
PRINT /T
will cancel the current print job and the rest of the print queue on the default printing device.
If you want to cancel a job on a device other than the default, add the switch
/D:<device>
where <device> is the name of the print device (e.g., LPT2). //