Listing of Sites
www.lockless.com www.crack.net www.batpower.net |
Novell 3x Commands
Run from workstation or autoexec.ncf
Syscon used to create users, delete accounts, modify rights, modify login scripts, modify server autoexec.ncf and startup.ncf in Sys:Public
Pconsole- Create Print qs and assign them to printers and users. Load Pconsole.nlm in server to make this work, and pconsole in Novell Dos for a Print server running on a workstation.
Filer – create directories and assign rights
Dspace- limits space a user can have on their server home directory.
Rconsole- utility that allows you remotely login to the server as though you are in front of it. The password can be changed in the autoexec.ncf by typing Remote Password.
Grant – to allow a directory or file right to a user
Allow directory to inherit rights- used to limit rights to a user
Flag – Changes the attributes of a file (similar to attrib in dos)
Map p:=server:volumer/path to map a drive
Map root p:=server:volume/path to appear as the root of the drive in dos/windows
Map s1:=server:volume – for apps to use to search when launching server based programs
Map search next server:volume for making the search drive the next drive letter available.
Makeuser- same as Syscon but a command line utility
Printcon- allows you to change the print job configuration
Printdef- allows printer configuration
Salvage- command line that allows you to recover files deleted previously before they are purged
Purge /all purge all files headers from deleted files.
Broadcast- sends a message to users
Caston allows you to see these messages
Castoff /all keeps them from appearing
Whoami- takes your DNS host name in you workstation and tells you to what servers you are attached
Trackon - tracks detail information as packets traverse the network, and trackoff turns it off.
Run from Server
Load cpqda386.dsk – an example of loading a disk drivers so Netware can boot
Load cdrom volume- loads a cd as a volume in Netware
Load cdutil Loads Scsi Express and auto mounts cds
Astart6 – loads Arcserve using version 6
Modules- shows all loaded NLMs in memory
Load Monitor loads the monitor utility. The most important is the utilization. You can also kick off users. Similar to Fconsole, but with more features.
Gosql- loads SWQL server if installed
Display servers – shows all servers attached to the network. It also shows workstations attached and identified by their DNS name.
Load cpqnf3.lan name=board2 frame=Etehrnet_II slot=8 an example of loading the lan nlm just before loading ip. Also specifies the frame type.
Bind ip to board 1 addr=192.168.0.2 mask=255.255.255.0 gate=192.168.0.1 an example of enabling IP
Load cpqnf3.lan name=board2 frame=Etehrnet_802.2 slot=8 loads the lan nlm just before binding ipx
Bind ipx Board1 net=17826300 binds ipx to the NIC
Name- shows name of file server
Server.exe starts the server –s does not run the autoexec.ncf or startup.ncf files. In this case you will need to load the disk driver, make up a name for the server and internal IPX number, and mount the volumes
Mount volumename- mounts the volume name of your choice. /all mounts all known volumes.
CLS clears the screen
Down- brings down the server
Exit- exits to dos after the server is brought down.
Load tcpip – loads the tcpip information into the server. IPX/SPX is automatically loaded and not necessary to include.
Load cpqsnmp- allows monitoring of tcpip activity.
Load – this command is used to load NLMs and DSK information
Clear station- command line that kicks off a specific user by their IPX number.
Disable login- Keeps users from logging in.reset router resets file server or router table if it’s suspect to being corrupt.
Enable login- enable the ability to log back in if disable login was typed.
Remove dos- removes command.com from file server memory. When rebooted the memory returns unless this command is typed again. This also increases file security.
set time month.day.year hour:minute:second sets time and date
Time- just displays time only
Unbind- unbinds IP or IPX from the specified card
Unload- unloads any unwanted nlms to free up memory
Display networks- shows hop count and other info about all other networks attached to your server.
UPS Status- indicates status of an attached UPS.
Volumes- shows all mounted volumes.
Load install.nlm – loads the install utility on the file server.
Load vrepair – repairs volumes with corruption. Make sure volume is unmounted before running.
Load bindfix- fixes the bindery in case the users all disappear or the file becomes corrupt.
Load UPS.nlm allows Novell to converse and set up a UPS.
NDS Commands and Utilities
Utilities
DSmaint.nlm - provides control when certain hardware maintenance operations are needed.
DSmerge.nlm Allows more than one part of a tree to merge together. It can also rename directories and do time synch. with the rest of the tree.
netsync- Allows you to sync objects with ver 3x in an NDS environment.
servman- monitors netware 4.x servers.
Pconsole- Create Print qs and assign them to printers and users. Load Pconsole.nlm in server to make this work, and pconsole in Novell Dos for a Print server running on a workstation.
Filer – create directories and assign rights
Rconsole- utility that allows you remotely login to the server as though you are in front of it. The password can be changed in the autoexec.ncf by typing Remote Password.
Command line utilities
salvage- command line that allows you to recover files deleted previously before they are purged
Purge /all purge all files headers from deleted files.
Load cpqda386.dsk – an example of loading a disk drivers so Netware can boot
Load cdrom volume- loads a cd as a volume in Netware
Load cdutil Loads Scsi Express and auto mounts cds
Astart6 – loads Arcserve using version 6
Modules- shows all loaded NLMs in memory
Load Monitor loads the monitor utility. The most important is the utilization. You can also kick off users. Similar to Fconsole, but with more features.
Gosql- loads SWQL server if installed
Display servers – shows all servers attached to the network. It also shows workstations attached and identified by their DNS name.
Load cpqnf3.lan name=board2 frame=Etehrnet_II slot=8 an example of loading the lan nlm just before loading ip. Also specifies the frame type.
Bind ip to board 1 addr=192.168.0.2 mask=255.255.255.0 gate=192.168.0.1 an example of enabling IP
Load cpqnf3.lan name=board2 frame=Etehrnet_802.2 slot=8 loads the lan nlm just before binding ipx
Bind ipx Board1 net=17826300 binds ipx to the NIC
Name- shows name of file server
Server.exe starts the server –s does not run the autoexec.ncf or startup.ncf files. In this case you will need to load the disk driver, make up a name for the server and internal IPX number, and mount the volumes
Mount volumename- mounts the volume name of your choice. /all mounts all known volumes.
CLS clears the screen
Down- brings down the server
Exit- exits to dos after the server is brought down.
Load tcpip – loads the tcpip information into the server. IPX/SPX is automatically loaded and not necessary to include.
Load cpqsnmp- allows monitoring of tcpip activity.
Load – this command is used to load NLMs and DSK information
Clear station- command line that kicks off a specific user by their IPX number.
Disable login- Keeps users from logging in.reset router resets file server or router table if it’s suspect to being corrupt.
Enable login- enable the ability to log back in if disable login was typed.
Remove dos- removes command.com from file server memory. When rebooted the memory returns unless this command is typed again. This also increases file security.
set time month.day.year hour:minute:second sets time and date
Time- just displays time only
Unbind- unbinds IP or IPX from the specified card
Unload- unloads any unwanted nlms to free up memory
Display networks- shows hop count and other info about all other networks attached to your server.
UPS Status- indicates status of an attached UPS.
Volumes- shows all mounted volumes.
Load install.nlm – loads the install utility on the file server.
Load vrepair – repairs volumes with corruption. Make sure volume is unmounted before running.
Load bindfix- fixes the bindery in case the users all disappear or the file becomes corrupt.
Load UPS.nlm allows Novell to converse and set up a UPS.
Workstation commands
Setpass - Changes passowrd from workstation
Broadcast- sends a message to users
Caston allows you to see these messages
Castoff /all keeps them from appearing
Whoami- takes your DNS host name in you workstation and tells you to what servers you are attached
Trackon - tracks detail information as packets traverse the network, and trackoff turns it off.
Printcon- allows you to change the print job configuration
Printdef- allows printer configuration
Npath- check and alter search path
Nmenu- replaces ver 3x menu.bat to cretae menus for users in tandem with Novell's application launcher.
Nlist
nwxtract
ncopy
Nprinter - replaces rprinter from ver 3x. Enables a print server to send jobs to a networked printer.
ncupdate - allows you to changes a user's netcfg file if a change needs to happen in the container.
cx - alloews administrator to view contents of the tree
nprint- command line print utility
nver - shows version
Atotal
wsupgrd
Auditcon - Audits network activity for security purposes.
Workstation Utilities
NW Admin - Use to create and delete users, printers, print qs, print servers, and other objects. You must be running client 32 to use. Also creates and edits login scripts and startup files. You can also limit disk space for users, change passwords, and change rights. You can view every server and container in the tree. This is the most powerful of all NDS utilities.
Netadmin- Similar to NW Admin, except that it is DOS based.
Netware Application manager- NAL.exe. Manges application objects on your deskptop. Enables users to run apps that were previously configured by an administrator.
partmgr.exe - Enable syou to create, delete, or manage partitions. Some of its commands are: create partition, move partition, add replica, move subtree, abort partition, move replica.
uimport.exe - Enables you to import users from a database.
|
2. COMMUNICATE WITH A MODEM ~~~~~~~~~~~~~~~~~~~~~~~~ Q: How do I communicate with my modem either in a BATch or on
the command-line ?
A: After setting up the COM port with MODE if required simply
use DOS redirection > to ECHO AT commands to it.
E.G. MODE COM1 baud=19200 data=8 parity=n stop=1
ECHO AT&FF10N4&D3E0M0Q1S0=1&W0>COM1
might be used to set up a modem loading a profile into it
or if you wanted to leave a computer accessible from a
remote location you might shell out of a communications
program and run a batch file containing:
%COMSPEC% /e:1024 >COM1
which would start a copy of the command processor to accept
input from the remote computer and output to it.
(with MS-DOS error messages would not get sent but 4DOS
allows STNDERR device writes to be re-directed)
Get right with Debug
DATE & TIME USE IN A BAT ~~~~~~~~~~~~~~~~~~~~~~~~ Q: How do I create a LogFile or get the current Time & Date into environment variables.
A: A number of utilities to get the time or date into an
envar exist, among them are P2E, GET25, BATCHMAN & STRINGS
but a pure MS-DOS solution exists too:
VER|TIME|FIND "Current">$$$.BAT
ECHO SET CTIME=%%3>CURRENT.BAT
$$$.BAT
will place the current TIME into an envar called CTIME and
TIME can be replaced with DATE above to create CDATE.
To create a log of system boots the following could be
inserted into the AUTOEXEC.BAT file:
ECHO -=-=-=-=-=-=-=-=-=-=-=-=-=-=->>BOOTLOG.TXT
ECHO System booted !!! >>BOOTLOG.TXT : For more :
VER|TIME|FIND "Current">>BOOTLOG.TXT : techniques :
VER|DATE|FIND "Current">>BOOTLOG.TXT : type $ :
Using P2E to create filenames in YYMMDD.* format :
@ECHO OFF
ECHO.|DATE|P2E /E MM /L 1 /M 21,2 /E DD /L 1 /M 24,2 /E YY /L 1 /M 29,2
ECHO This is a New File>%YY%%MM%%DD%.TXT
Using PROMPT and CALL to create an 'ECHO'able Current Date & Time :
@ECHO OFF
ECHO @PROMPT LOG ON: at >C:TEMPTEMP$$$$.BAT
%COMSPEC% /C C:TEMPTEMP$$$$|FIND ":">>C:LOGONS.TXT
Typical resultant contents of c:logons.txt will be:
LOG ON: Fri 12-27-1993 at 09:37:48
LOG ON: Tue 01-04-1994 at 08:54:26
--etc.--etc.--
The section of the line between @PROMPT and the > is customizable
and all valid for the PROMPT command can be used as well as
the current system date and time.
4. COMBINE FILES INTO ONE
~~~~~~~~~~~~~~~~~~~~~~
Q: I have lots of text files that I want to combine into one,
how can I automate this with a BATch.
A: The DOS COPY command can be used or redirection of TYPE's
output as follows:
COPY *.TXT ALL.XXX
RENAME ALL.XXX ALL.TXT
or
FOR %%f IN (*.TXT) DO TYPE %%f>>ALL.XXX
RENAME ALL.XXX ALL.TXT
The renaming of the resultant file is necessary, as when
it is created by the first COPY or TYPE operation, were
it called ALL.TXT it would immediately qualify for
inclusion in the command as it would match the filespec.
COPY can do binary concatenations too, with the /B param
MS-Windows remakes WIN.COM everytime Setup is used similar
to: COPY /B WIN.CNF+VGALOGO.LGO+VGALOGO.RLE WIN.COM
5. FORMATTING DISKS- Q & A
~~~~~~~~~~~~~~~~~~~~~~~
Q: How do I format a disk without DOS asking me questions ?
A: With MS-DOS 3.3 use FORMAT A: /H
With MS-DOS 4.0+ use FORMAT A: /AUTOTEST
!!! BEWARE - THIS WORKS ON HARD DISKS TOO !!!
There are a number of other undocumented switches for both
FORMAT and other MS-DOS features detailed in the MUF.
(For information about the MUF see item # 15. below)
6. GETTING ERRORLEVELS- Q & A
~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: How do I echo the errorlevel returned by a program to the
screen so I can 'debug' my batch files ?
A: There are a couple of utilities that can do this but the
method used for the FAQ is the pure DOS solution below :
FOR %%E IN (0,1,2) DO IF ERRORLEVEL %%E00 SET ERLVL=%%E
IF "%ERLVL%"=="0" SET ERLVL=
SET RANGE=0,1,2,3,4,5,6,7,8,9
IF "%ERLVL%"=="2" SET RANGE=0,1,2,3,4,5
FOR %%E IN (%RANGE%) DO IF ERRORLEVEL %ERLVL%%%E0 SET ERLVL=%ERLVL%%%E
IF "%ERLVL%"=="0" SET ERLVL=
IF NOT "%ERLVL%"=="25" SET RANGE=0,1,2,3,4,5,6,7,8,9
FOR %%E IN (%RANGE%) DO IF ERRORLEVEL %ERLVL%%%E SET ERLVL=%ERLVL%%%E
SET RANGE=
ECHO Errorlevel is %ERLVL%
Here is a line-by-line walk thru' of this courtesy Rudy Lachin:
FOR %%E IN (0,1,2) DO IF ERRORLEVEL %%E00 SET ERLVL=%%E If errorlevel
is greater than 0 set ERLVL to 0, if >100 to 1 and if >200 to 2.
IF "%ERLVL%"=="0" SET ERLVL= If ERLVL=0 clear it (suppress leading 0)
SET RANGE=0,1,2,3,4,5,6,7,8,9 Now we've set the hundreds check tens
except when the errorlevel is >200 in which case we only want to go up
IF "%ERLVL%"=="2" SET RANGE=0,1,2,3,4,5 to the fifties.
FOR %%E IN (%RANGE%) DO IF ERRORLEVEL %ERLVL%%%E0 SET ERLVL=%ERLVL%%%E
If the errorlevel in this range of tens is above x00 set ERLVL to x00,
if > x10 set ERLVL to x10, if > x20 set ERLVL to x20, etc.
IF "%ERLVL%"=="0" SET ERLVL= If ERLVL=0 clear it (suppress leading 0)
IF NOT "%ERLVL%"=="25" SET RANGE=0,1,2,3,4,5,6,7,8,9 Now we check the
units except if the errorlevel is 250+ where we only check up to 5 by
not resetting the RANGE variable contents but re-using it as set above.
FOR %%E IN (%RANGE%) DO IF ERRORLEVEL %ERLVL%%%E SET ERLVL=%ERLVL%%%E
If the errorlevel in range of units is above xy0 set ERLVL to xy0, etc
SET RANGE= Clear the RANGE variable from the environment
ECHO Errorlevel is %ERLVL% and display the variable ERLVL on screen.
7. HELP WITH MAKING A MENU
~~~~~~~~~~~~~~~~~~~~~~~
Q: How do I make a menu system with batch files ?
A: Here's how you could do it with all BATs in a DIR in your PATH
This is MENU.BAT | This is 3.BAT
@ECHO OFF | @ECHO OFF
CD | CD
ECHO MAIN MENU | ECHO GAMES MENU
ECHO [1] Word Processor | ECHO [31] DooM -Save The Universe!
ECHO [2] Spreadsheet | ECHO [32] FRAC -Tetris Clone 3D
ECHO [3] Games | ECHO [33] Return To Main Menu
ECHO. | ECHO.
PROMPT Type the number and[ENTER] | PROMPT Type the number and[ENTER]
-------------+-------------+-------+------+--------------+--------------
This is 1.BAT|This is 2.BAT|This is 31.BAT|This is 32.BAT|This is 33.BAT
@ECHO OFF | @ECHO OFF | @ECHO OFF | @ECHO OFF | @ECHO OFF
CDWP51 | CDQPRO | CDFUNDOOM | CDFUN | CD
WP51.EXE | Q.EXE | DOOM.EXE | FRAC.EXE | CLS
MENU.BAT | MENU.BAT | 3.BAT | 3.BAT | MENU.BAT
8. IS TSR LOADED IN MEMORY ?
~~~~~~~~~~~~~~~~~~~~~~~~~
Q: How can I test to make sure a TSR like ANSI.SYS is loaded?
A: All memory-resident programs have to use memory and so an
output from the MEM /C command will show them resident.
The BATch below ('hook' needed) illustrates the technique.
@echo off -----
if %1'==' goto syntax
mem /c|find /i "%1">temp.tmp
copy /b temp.tmp+,, >nul
if exist temp.tmp echo Program: %1 was found in memory.
if not exist temp.tmp echo Program: %1 is not loaded.
if exist temp.tmp del temp.tmp
goto end
:syntax
echo Usage: %0 [TSR to find in memory]
echo Example: %0 mouse
:end
9. JUMP BACK TO PRIOR DRIVE / DIRECTORY
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: When I run a program or command how can I get back to the
directory that was current prior to command execution ?
A: Several solutions are available as small utilities but
below is a pure DOS solution.(using environment variables)
(4DOS has built in variables to deal with this situation)
::Set Envars to current drive & current directory
@echo @prompt SET OLDRV OLDIR >TEMP.BAT
@command /c TEMP.BAT > TEMP$.BAT
@call TEMP$>BAT >nul
@del TEMP$?MP.BAT
Once this BATch has been CALL'd or run:
%OLDRV% will be evaluated to be the drive when BAT was run
and %OLDIR% will be evaluated to be the prior directory.
10. FIND & REPLACE TEXT IN FILE
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: Is there a piece of software that does string search and
replacement from the command line ?
A: EDLIN (included with MS-DOS) is ideal for this.
EDLIN FILENAME.EXT
with the contents of REPLACE.SCR below
1,#Rold string^Znew string
e
will replace every occurrence of "old string" throughout
FILENAME.EXT with "new string"
NB Using ^Z (Ctrl+Z) in a BATch is impossible as DOS sees it
as an End-Of-File marker. Try Rob Flor's ALTER for BATches.
11. LOW LEVEL HARD-DISK FORMATTING
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: How can LowLevel Format my Hard-Disk ? I heard you could
use DOS's DEBUG command, is it true ?
A: Older styles of drives (mostly MFM style) did have such
routines situated in a Read Only Memory BIOS chip on their
controller card. However some controllers had their code
located at a different memory address to others. Below is
the command to run this code for the most common types.
ECHO g=c800:5|DEBUG
WARNING !
Do not try this with Integrated Drive Electronics (IDE)
type drives and if in doubt - Don't.
Some IDE controllers will pretend to LLF, others will just
hang the PC. It will not even work on ALL MFM type HD's.
Some IDE's (apparently) can be damaged by attempting this.
12. FOR..IN..DO Queries
~~~~~~~~~~~~~~~~~~~~
Q: How does this command work and what's the %%F stuff for ?
A: The FOR..IN..DO command can be used either in batch files
where you need to use %%F (two percent signs and variable)
or at the prompt where only one percent sign is needed.
In ordinary words the command is "With every member of
| this (collection of things) do this command". As with most
DOS commands a little lateral thinking can lead to quite
complex usage but in its simplest form you could replace
DIR /B with FOR %F IN (*.*) DO ECHO %F
(You would need to replace %F with %%F if used in a BATch)
The %F or %%F is just a temporary variable only active
while the FOR..IN..DO command is executing, the alphabetic
character does not have any special meaning, it is just a
'handle' for DOS to use to pass each member of the set at
a time along to the DO part of the command. You could run
all BAT's in sequence with FOR %B IN (*.BAT) DO CALL %B
13. "OUT OF ENVIRONMENT" QUESTIONS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: Often when I try and run BATch files they don't work and
I get "Out of Environment Space" error messages, Why ?
A: The 'environment' is used for variables like %PATH% and
%PROMPT% and you may need to increase it's size for some
BATch files that create there own variables to hold data.
You can increase the size of the primary environment with
the /E parameter in your SHELL statement in CONFIG.SYS
E.G. SHELL=C:DOSCOMMAND.COM C:DOS /E:2048 /P
or you could make a temporary adjustment for the BATch
concerned by starting another copy of COMMAND.COM to run
it, and specifying a larger environment size for it.
E.G. %COMSPEC% /E:2048 /C SAMPLE.BAT
Utilities like STRINGS give you the chance to perform math
so you could test for adequate environment space in your
own BAT's, for variables, & then use this method if needed.
for more details of testing environment space type: !
Example of BAT that tests env size for itself using STRINGS
@echo off All this BATch does is run a
STRINGS efree= ENVFREE second copy of itself under
STRINGS SUB 300, %efree% >nul another copy of COMMAND.COM
if errorlevel 1 goto DOIT if environment space is less
STRINGS esize= ENVSIZE than 300 bytes, setting the
STRINGS esize= ADD %esize%, 300 new environment to 300 bytes
%comspec% /e:%esize% /c %0 bigger than the current.
goto END If space is already >or= 300
:DOIT it jumps to the DOIT label.
echo We've got 300+ bytes space now!
echo Environment Size: %esize% ; Environment Free: %efree%
:END +-----------------------------------------------
set efree= | With DOS you can check env. space usage with
set esize= | SET>TEMP.TMP then DIR TEMP.TMP filesize=usage
14. PATH GREATER THAN 128 CHARACTERS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: How can I make my Path bigger than 128 characters long ?
A: To use more than DOS's command-line limit of 128 chars
you need to set the PATH in the CONFIG.SYS file (MSDOSv6+)
or you use an utility like STRINGS or P2E.
As an alternative you may give sections of a directory
tree a label as if they were a separate drive. This will
cut the length of the path statement used for that subdir.
SUBST K: C:WINDOWS ( use in AE.BAT before the PATH line )
Using P2E: The following line in the Autoexec.Bat will
set the path to the contents of the mypath.txt textfile.
P2E Envar PATH
Using STRINGS: The following line in the AE.Bat will set
the path to the contents of the mypath.txt textfile.
STRINGS PATH= ASK
15. WHAT IS THE 'MUF'?
~~~~~~~~~~~~~~~~~~
Q: I've been referred to the MUF for an answer or explanation
to a problem I've posed. What, where, is it ?
A: The MUF is a list of Microsoft(DOS) Undocumented Features
It was compiled and edited by Gary Cooper from snippets in
this echo and from a few other sources.
Gary has passed the torch to Ron Warder, who will answer in
the echo, or via FidoNet NetMail at : 1:109/132
* The MUF is posted occasionally in the BATPOWER Echo, or
can be obtained from many BBS's as MUF17.ZIP (as of 5-02-96)
16. RECURSION / LOOPS IN A BATCH FILE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: How do you do loops in a batch file ?
And what is recursion / what do you use it for ?
A: Both loops and recursion can be very useful because like
other programming languages they can make batch files
smaller and more effective users of disk space.
Loops can be either unconditional jumps to a label using
the GOTO command or by using IF EXIST or IF ERRORLEVEL can
be made conditional. The BATch running now to show you
these screens shows both these methods and also shows a
command that effectively provides looping by performing a
command for each member of a set of objects. That command
is: FOR %%[variable] IN ([set]) DO [command]
Recursion is really just another sort of loop except that
the batch file actually starts running another copy of
itself, normally by executing %0 (its name as typed). This
allows the batch to do work and restart to do more work.
17. START UP SCREEN ROTATION
~~~~~~~~~~~~~~~~~~~~~~~~
Q: Is there a way to rotate files, so that the same screen
isn't displayed all the time ?
A: One method of many available keeps screens in an archive
until needed with all screens stored in their own subdir
:ROTATE
IF NOT EXIST SCREEN.??? PKUNZIP SCREENS.ZIP
DEL SCREEN.BBS
REN SCREEN.??? SCREEN.BBS
REM done
This same method could be used to rotate different BBS
front screens or to rotate different .BMP or .RLE files
so Windows wallpaper is rotated for each new session.
18. TIDYING SCREEN OUTPUT FROM A BATCH FILE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: How do I stop commands from displaying output on screen ?
A: Just re-direct their output to the nul device.
E.G. PAUSE>NUL Will just wait for a keypress before
continuing, without displaying the usual message:
"Press any key to continue..."
To hide error messages as well you'll need to use:
CTTY NUL
command that displays error you don't want to see
CTTY CON
Be Careful ! While CTTY NUL : the keyboard is ignored !
Q: Sometimes when I execute a batch file after running I'm
left with more than one prompt (as if I'd hit Enter).
A: This is because the batch file has trailing carriage-
returns. Use a plain text (ASCII) editor to remove them.
19. Using ANSI (escape codes) in a BATch File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: I know I need to use an ESC character (Alt+27) to use
ANSI codes but whenever I try DOS or Editors give me a
slash or clear the line ?
A: Use DOS EDIT and press Ctrl+P (which puts you in 'literal'
mode) and then press Esc and you'll see a small left
pointing arrow; this is the Esc character. Some editors
like QEDIT allow you to use the numeric keypad to enter
the Alt+27 sequence as well (or instead).
Specialist ANSI screens editors like TheDraw can save you
a lot of time and are much easier to use !
To use ANSI in your PROMPT the code is an Esc character.
If you use 4DOS use lines like the following instead;
SCRPUT 6 34 BLINK BRIGHT RED ON BLUE W A R N I N G !
This will write 'W A R N I N G !' in blinking bright red
on a blue background with the W at row 6, column 34.
20. Using REM or :: (double colons) in a BATch File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: I heard double colons are better than REM statements, why?
A: Even though a REM statement is a remark DOS will still
read the whole line in case it's being re-directed.
Double colons are seen as an invalid label by DOS when it
starts to read the line so it skips on to the next line.
The other way to speed up execution of a batch file that
has lots of comments is to un-conditionally jump over the
lines that are comments like this:
@ECHO OFF
GOTO START
This is a comment line that'd slow down the BAT
So is this line Ú-------------------------
And so is this one as well | Be careful using double
:START | colons with 4DOS !
--continue-with-batch-file-- |::LABEL is a valid label.
21. IS BATCH FILE RUNNING FROM WITHIN WINDOWS ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: How can I make sure Windows isn't running before I run a
program in a batch file ?
A: Either use a purpose-made COM program such as ISWINRUN.COM
a DEBUG script for which is below, it will exit with 1 as
ERRORLEVEL if Windows is running , OR use the FIND command
to look at the output of the MEM /C command to search for
Windows' 'hook' in memory. If Windows is running in 386Enh
mode a 'hook' called win386 will be in memory when you are
in a DOS window. Solutions are outlined below:
-------------------------------------------------------------
nISWINRUN.COM
e100 B8 80 46 CD 2F 3D 0 0 74 2 B0 1 34 1 B4 4C CD 21
RCX Ú----------------------------------------------------
12 | MEM /C|FIND "win386">temp.$$$
W | COPY /B temp.$$$+,,
Q | IF EXIST temp.$$$ ECHO This is a DOS Window !
22. USING CTRL+Z IN A BATch
~~~~~~~~~~~~~~~~~~~~~~~
Q: How can you use Ctrl+Z in a batch file, whenever I put one
in a BATch that's where execution of the BATch stops. ?
A: This happens because Ctrl+Z is an End-Of-File Marker for
DOS (EOF). Using EDLIN in a BATch often needs the Ctrl+Z
to be entered into a script and one of the few ways to do
this is from the command prompt.
Type: SET ZED=(Ctrl+Z) Replacing the bracketed text
with the real key combination.
In BATch files thereafter you can use %ZED% where you are
required to use a Control+Z key combination.
As an example the little batch file below, will search README.TXT
& replace every instance of 'Marvelous' with 'Wonderful'.
ECHO 1,#RMarvelous%ZED%Wonderful>test.scr
ECHO e>>test.scr
EDLIN README.TXT
23. ZERO BYTE FILES - Questions
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q: Does a zero-byte file use a cluster of the disk ?
A: NO ! However it does use one directory entry and so very
occasionally should the file be in a subdirectory, the
entry may need an extra cluster for the directory table.
One of the features of zero-byte files is that MS-DOS will
not copy them so COPY /B filename.ext+,, will delete the
file if it is zero-byte or if it is not will reset its
Date/Time Stamp to the system's current settings.
To create a zero-byte file as a 'flag' use: REM>FLAG.$$$
Here's an example of how you might use this 'feature':
CD
DIR /B /S|FIND /i "filename.ext">FLAG.$$$
COPY /B FLAG.$$$+,,
IF EXIST FLAG.$$$ ECHO filename.ext was found
IF NOT EXIST FLAG.$$$ ECHO filename.ext is not on drive.
|

Any Query Contact Me at Following Address
Send an email |