home / infca / mq_v7 (navigation links) Style never goes out of fashion

El vell DOS ... mai morirà !

FOR | MQ | BIOS URLs | End
C:\TEMP > help

For more information on a specific command, type HELP command-name.

ASSOC    Displays or modifies file extension associations
AT       Schedules commands and programs to run on a computer.
ATTRIB   Displays or changes file attributes.
BREAK    Sets or clears extended CTRL+C checking.
CACLS    Displays or modifies access control lists (ACLs) of files.
CALL     Calls one batch program from another.
CD       Displays the name of or changes the current directory. Ver "CD /D"
CHCP     Displays or sets the active code page number.
CHDIR    Displays the name of or changes the current directory.
CHKDSK   Checks a disk and displays a status report: chkdsk /f /r
CHKNTFS  Displays or modifies the checking of disk at boot time.
CLS      Clears the screen.
CMD      Starts a new instance of the Windows 2000 command interpreter.
COLOR    Sets the default console foreground and background colors.
COMP     Compares the contents of two files or sets of files.
COMPACT  Displays or alters the compression of files on NTFS partitions.
CONVERT  Converts FAT volumes to NTFS. You cannot convert the current drive.
COPY     Copies one or more files to another location.
DATE     Displays or sets the date.
DEL      Deletes one or more files.
DIR      Displays a list of files and subdirectories in a directory.
DISKCOMP Compares the contents of two floppy disks.
DISKCOPY Copies the contents of one floppy disk to another.
DOSKEY   Edits command lines, recalls Windows 2000 commands, and creates macros.
ECHO     Displays messages, or turns command echoing on or off.
ENDLOCAL Ends localization of environment changes in a batch file.
ERASE    Deletes one or more files.
EXIT     Quits the CMD.EXE program (command interpreter).
FC       Compares two files or sets of files, and displays the differences between them.
FIND     Searches for a text string in a file or files.
FINDSTR  Searches for strings in files.
FOR      Runs a specified command for each file in a set of files.
FORMAT   Formats a disk for use with Windows 2000.
FTYPE    Displays or modifies file types used in file extension associations.
GOTO     Directs the Windows 2000 command interpreter to a labeled line in a batch program.
GRAFTABL Enables Windows 2000 to display an extended character set in graphics mode.
HELP     Provides Help information for Windows 2000 commands.
IF       Performs conditional processing in batch programs.
LABEL    Creates, changes, or deletes the volume label of a disk.
MD       Creates a directory.
MKDIR    Creates a directory.
MODE     Configures a system device.
MORE     Displays output one screen at a time.
MOVE     Moves one or more files from one directory to another directory.
PATH     Displays or sets a search path for executable files.
PAUSE    Suspends processing of a batch file and displays a message.
POPD     Restores the previous value of the current directory saved by PUSHD.
PRINT    Prints a text file.
PROMPT   Changes the Windows 2000 command prompt.
PUSHD    Saves the current directory then changes it.
RD       Removes a directory.
RECOVER  Recovers readable information from a bad or defective disk.
REM      Records comments (remarks) in batch files or CONFIG.SYS.
REN      Renames a file or files.
RENAME   Renames a file or files.
REPLACE  Replaces files.
RMDIR    Removes a directory.
SET      Displays, sets, or removes Windows 2000 environment variables.
SETLOCAL Begins localization of environment changes in a batch file.
SHIFT    Shifts the position of replaceable parameters in batch files.
SORT     Sorts input.
START    Starts a separate window to run a specified program or command.
SUBST    Associates a path with a drive letter.
TIME     Displays or sets the system time.
TITLE    Sets the window title for a CMD.EXE session.
TREE     Graphically displays the directory structure of a drive or path.
TYPE     Displays the contents of a text file.
VER      Displays the Windows 2000 version.
VERIFY   Tells Windows 2000 whether to verify that your files are written correctly to a disk.
VOL      Displays a disk volume label and serial number.
XCOPY    Copies files and directory trees.

Echoing a blank line In v5.0 (and later), to echo a blank line on the screen, you can type ECHO and then a period (ECHO.). There must be no intervening space.

c:\>echo . . c:\>echo. c:\>

SUB (x1A) at end of COPY

The placing of /a and /b switches is critical. They perform differently depending on whether they are placed after the source filename(s) or the target filename.

When used with the source filename

When used with the destination filename

So, we better use

sz_MyCmd = "copy /Y" fn_pfx || "+" || fn_qqs || "+" || fn_sufx fn_HTML "/b"

url


DATE / TIME commands

The DATE command :

c:\>date /? Displays or sets the date. DATE [/T | date] Type DATE without parameters to display the current date setting and a prompt for a new one. Press ENTER to keep the same date. If Command Extensions are enabled the DATE command supports the /T switch which tells the command to just output the current date, without prompting for a new date. c:\> date /T 18/03/2011

The TIME command :

c:\>time /? Displays or sets the system time. TIME [/T | time] Type TIME with no parameters to display the current time setting and a prompt for a new one. Press ENTER to keep the same time. If Command Extensions are enabled the TIME command supports the /T switch which tells the command to just output the current time, without prompting for a new time. c:\> time /T 13:42
Timestamp

Per un script :

@echo off echo "Hora == {"%time%"}." echo "Deit == {"%date%"}."

Una mica millor :

@echo off set mydate=%date:~10,4%_%date:~4,2%_%date:~7,2% echo %mydate%

En format angls:

@echo off set mydate=Y%date:~6,4%/M%date:~3,2%/D%date:~0,2% set mytime=H%time:~0,2%:M%time:~3,2% echo %mydate% + %mytime%

Compte amb el LOCALE !

Generated FileName

This code:

set dd=%date% %time% echo date time (%dd%) :: date time (30-10-14 12:45:02,60 ) set FN2=MyFile__%dd:~0,2%_%dd:~3,2%_%dd:~6,2%___%dd:~9,2%_%dd:~12,2%.txt echo fn (%FN2%)

Produces this output:

date time (30-10-14 12:51:08,56 ) fn (MyFile__30_10_14___12_51.txt)

FTP from batch

Code FTP values into DO_IT.FTP :

open files.000webhost.com ; destination host this-is-my-user this-is-my-pwd binary cd public_html ; destination folder mput qq_127.html ; destination filename disconnect quit

And then lauch it using

ftp -i -s:do_it.ftp
All in one file

We can do it in just one batch file :

@echo off REM Generate the script - overwrite any existing temp.txt echo open servername > temp.txt echo my_username >> temp.txt echo my_password >> temp.txt echo get %1 >> temp.txt echo quit >> temp.txt REM Launch FTP and pass it the script ftp -s:temp.txt REM Clean up del temp.txt

Get previous command Return Code

As in Linux we have "$?", in DOS we have "%errorlevel%"

set IP_CAN_COLL=172.25.66.12 set IP_PROXY=10.139.130.65 echo Comprovem que som a la xarxa GUIFI fent PING al PROXY (%IP_PROXY%) :: ping %IP_PROXY% echo Anem a llegir INDEX.HTML des (%IP_CAN_COLL%) wget %IP_CAN_COLL% -e use_proxy=yes -e http_proxy=%IP_PROXY%:3128 echo Exit Code is {%errorlevel%}

DOS bits

CONFIG.SYS

 rem Load DOS into the HMA (7.0) :
 DEVICE=C:\DOS\HIMEM.SYS
 DOS=HIGH

 rem Load Stack spaces to handle interrupts in real mode into HIGH :
 STACKSHIGH=9,256

 rem Load LASTDRIVE into HIGH (7.0) :
 LASTDRIVEHIGH=Z

 rem Load FILES into HIGH (7.0) :
 FILESHIGH=40

 rem Load BUFFERS into HIGH (7.0) :
 BUFFERSHIGH=40

Enable the Ability to Load Devices into Upper Memory

At the top of the file, after the HIMEM device, add a line with the text "device=c:\windows\emm386.exe NOEMS" where 'c:\windows' is the path to the himem.sys file.

URL

AUTOEXEC.BAT

 rem Speed up disks (7.0) - after MSCDEX.EXE !!! :
 c:\dos\SMARTDRV.EXE 2048

 rem Set Temporary path
 SET TEMP=c:\TEMP
 SET TMP=c:\TEMP

 rem Clear Temporary files
 echo Cleaning TEMP directory %TEMP%
 DELTREE /Y %TEMP%\*.* > NUL

 rem Set DIR comand : sort by Name
 SET DIRCMD=/ON


Load Drivers and Programs into High Memory

In front of any lines loaded applications or drivers, for example MSCDEX.EXE, append "LH" (for Load High), for example:

 LH C:\WINDOWS\COMMAND\MSCDEX /D:MSCD001
URL

Use Extended Memory

At the top of the file add a line with the text "device=c:\windows\himem.sys" where 'c:\windows' is the path to the himem.sys file.

URL


Load DOS Command Processor into High Memory

Add a new line with the text "DOS=HIGH,UMB".
Make sure the following lines also exist at the top of the file (without them DOS can not be loaded into upper memory).

 DEVICE=C:\WINDOWS\HIMEM.SYS
 DEVICE=C:\WINDOWS\EMM386.EXE NOEMS
URL
PATH modify [ W2K ]

In order to modify the PATH environment variable, go to Control Panel + System, select Advanced, and then Environment Variables.

PATH modify [ WXP ]

Go to Control Panel, click on System, then Advanced Options. There is an "Environment Variables" button ...


Manualment :

PATH="C:\Program Files\Mi Programa";%PATH% echo %PATH%

Not Limited to 128 Characters : To create a path with more than 128 characters, use the PATH command in the CONFIG.SYS file, (instead of in the AUTOEXEC.BAT file) using the "SET" command.

Envir vars

Use the SET command to display them all.

Use "SET <prefix>" to display a subgroup of envir vars all of them starting with "prefix".

Example : SET MQSI muestra

MQSICOMMAND_PATH=C:\Program Files\IBM\MessageBrokersToolkit\6.0\eclipse; C:\Program Files\IBM\MessageBrokersToolkit\6.0 MQSI_CATALINA_HOME=C:\Program Files\IBM\MQSI\6.0\catalina MQSI_CONSOLE_NLSPATH=C:\Program Files\IBM\MQSI\6.0\messages\ MQSI_DEVELOPMENT=SOFTWARE\IBM\WebSphereMQIntegrator\2 MQSI_EXMLTCONFIGPATH=C:\Program Files\IBM\MQSI\6.0\exmltConfig MQSI_FAD=3 MQSI_FILEPATH=C:\Program Files\IBM\MQSI\6.0 MQSI_JARPATH=C:\Program Files\IBM\MQSI\6.0\classes;C:\Program Files\IBM\MQSI\6.0\messages; MQSI_LILPATH=C:\Program Files\IBM\MQSI\6.0\bin;C:\Program Files\IBM\MQSI\6.0\jplugin; MQSI_REGISTRY=C:\Documents and Settings\All Users\Application Data\IBM\MQSI MQSI_VERSION=6.0.0.1 MQSI_VERSION_F=1 MQSI_VERSION_M=0 MQSI_VERSION_R=0 MQSI_VERSION_V=6 MQSI_WORKPATH=C:\Documents and Settings\All Users\Application Data\IBM\MQSI

O

c:\> set HOME HOMEDRIVE=C: HOMEPATH=\Documents and Settings\Administrator
Few interesting envir vars
set MY_HN=%COMPUTERNAME% set MY_PWD=%cd%
get IP into an envir var
for /f "tokens=1 delims=:" %%j in ('ping %computername% -4 -n 1 ^| findstr Reply') do ( set localip=%%j ) echo Local IP is: "%localip%" set myip=%localip:~11% echo Your local IP is: "%localip:~11%" echo My IP : %myip%

Note that the -4 in the ping command forces IPv4 on Win7 and is ignored on XP. The :~11 in the variable name expands beginning at the 11 character in the var

Redirecció
saveqmrc --help 2> ajuda.txt    ; write both standard output and standard error to file
agafa > err.txt 2>&1            ; idem
mycommand  > nul                ; ignore output (but not error messages)
my_cmd > nul 2>&1               ; ignore all

Using command redirection operators ; another.

Under Linux it becomes

"rm -f" fOut "> /dev/null 2>&1"
cmd >> file.txt 2>&1      ; append output to file

The format for appending standard output and standard error is &>> filename

So, we can send both stdout and stderr to same file, and set the program into background by :

my_prog &> output.log &
How to pass ALL parameters

To pass ALL the parameters to a batch file (in one step), use "%*" :

c:\notes\ldapsearch %*
Codepage's
C:\> chcp Active code page: 850
delay()

Si ens cal un delay() en un CMD, fem servir "ping" ...

@echo off
:bucle
wget <url>
ping -n 1   -w 900  1.2.3.4
goto bucle
Un bon BAT
@echo off
if .%1. == .. goto ajuda
if .%1. == .?. goto ajuda2
if .%1. == .c. goto client
if .%1. == .s. goto servidor
goto servidor
:
:client
set PATH_LIB=MQIC32.LIB
set OF=codiC.exe
goto fer
:
:servidor
set PATH_LIB=MQM.LIB
set OF=codi.exe
goto fer
:
:fer
echo "Posem PATH a MVS:"
 CALL "c:\MVS\VC98\Bin\VCVARS32.BAT"

echo "Compilem:" 
 CL  /I"C:\MQ\Tools\c\include"  codi.c  -o %OF%   "c:\MQ\Tools\Lib\%PATH_LIB%"
goto fi
:
:ajuda
echo *** Cal un parametre  ***
goto fi
:
:ajuda2
echo      Aquest BAT es una mostra.
:
:fi
CMDs anidats

Main CMD can use vars set in another (general) CMD:

> type create_qmgr_objects.cmd @echo off echo (2+) Create Qmgr Objects call setup_envir.cmd echo QM-1 name is (%QMN1%) echo DLQ name is (%DLQN%) echo (2-) Create Qmgr Objects
> type setup_envir.cmd echo (1+) Setup Envir SET QMN1=QQMM11 SET DLQN=DLQ echo (1-) Setup Envir
Un de professional
> type c:\mqlite\runtime\mqxr\bin\controlMQXR.bat set JAVAARGS= set DATADIR= set GLOBALDATADIR= FOR %%A IN (%*) DO (CALL :SCAN_ARG %%A) rem To support large numbers of concurrently connected clients. rem set JAVA=%JAVA% -Xms1024m" "-Xmx1024m if [%1] == [start] ( %JAVA% com.ibm.mq.MQXRService.RunMQXRService -t "%MQTTDIR%\config" %* ) else ( if [%1] == [stop] ( %JAVA% com.ibm.mq.MQXRService.EndMQXRService %* ) else ( if [%1] == [channel] ( %JAVA% com.ibm.mq.MQXRService.ControlMQXRChannel %* ) else ( echo "Unknown Mode" ) ) ) :SCAN_ARG rem Was the previous arg, a flag we need to act on? if %FLAG_DATADIR%==1 (call :GOT_DATADIR %1) if %FLAG_GLOBALDATADIR%==1 (call :GOT_GLOBALDATADIR %1) if %FLAG_JAVAARG%==1 (call :GOT_JAVAARG %1) rem Is the current arg an flag we need to act on if [%1] ==[-d] set FLAG_DATADIR=1 if [%1] ==[-g] set FLAG_GLOBALDATADIR=1 if [%1] ==[-J] set FLAG_JAVAARG=1 goto :eof
nou NP.CMD
start "titol" /B c:\sebas\Eines\npp.6.4.5\notepad++.exe %*
Omplir el disc
type adeu.cmd @echo off set mydate=Y%date:~6,4%/M%date:~3,2%/D%date:~0,2% :bucle set mytime=H%time:~0,2%_M%time:~3,2% set FN=%mytime%.a10 time /t echo "(*)" %mydate% + %mytime% Fer (%FN%) type src.txt >> %FN% goto bucle
Virgueries

c:\Eines> type prova.cmd @echo off title Malware Removal Tool ;) - By Smartgenius color 0a pause

Una altra
The pushd command saves the current working directory in memory so it can be returned to at any time, optionally changing to a new directory. The popd command returns to the path at the top of the directory stack.

set PWD=%cd% rem ** formatting the console *** title IBM WebSphere Application Server color 0b rem *** tailing the log file *** pushd %PWD%\..\apps\cdm620-was\profiles\AppSrv01\logs\server1 start %PWD%\tools\tail -f SystemOut.log
Eines
FDISK /MBR
FIDSK /MBR details :
 FDISK /MBR recreates the boot sector of the first (bootable) hard disk
 overwriting it with a fresh copy,
 by writing a new Master Boot Record (MBR) based on existent disk structure,
 without altering the partition table information.
This guy has got a lot of Tips & Tricks, as XP

If you want to restore Windows Bootloader and for some reason cannot use the windows installation CD, there is a simple way to do it : url

USB under DOS (dedicado a J. SIN, el pecador)

Article :

Imagine that you want to use Paragon Drive Backup, Powerquest's Drive Image, or Norton Ghost, to backup your hard disk partitions to that nice 120gb external USB 2.0 hard disk you just bought. You can't do it.

The minor miracle here is using a driver file called "USBASPI.SYS" ("Panasonic v2.06 ASPI Manager for USB mass storage"). Given the right parameter incantations, this 16-bit Panasonic-developed DOS driver will let your system boot good-old DOS -any flavour, maybe even Caldera's OpenDOS and recognize all USB devices connected to the respective controllers.

However, it should be noted that this driver will only map mass storage devices like external hard disks, cd- roms, cd-rw, dvd-rom, zip, jaz, ls-120, and flash memory to ASPI devices. Then you need an elusive "ASPI mass storage driver" to map HDs and flash disks it to a drive letter in DOS. This one goes by the name "di1000dd.sys", commonly referred to as the "Motto Hairu USB Driver".


http://www.stefan2000.com/darkehorse/PC/DOS/Drivers/USB/

http://www.freedos.org/freedos/news/technote/203.html

 USB support for DOS

 Arkady writes:

  The Inquirer publishes article, where noticed Matsushita's driver,
  which allows to work with external USB disks under DOS.
  Example of config.sys and autoexec.bat to access external CD-ROM:

    [config.sys]

     DOS=HIGH,UMB
     lastdrive=Z
     device=HIMEM.SYS
     devicehigh=USBASPI.SYS /v /w /e
     devicehigh=DI1000DD.SYS
     devicehigh=USBCD.SYS /d:USBCD001             /* CD */

    [autoexec.bat]

     LH MSCDEX /d:USBCD001                        /* CD */

 mhairu.zip [ridolaina/savesag] has
     16.368    di1000dd.sys
     43.528    USBASPI.SYS

Have a look here

Kayak (032006) :

 PCI   UHCI/OHCI/EHCI USB Host controller not found.
Boot DOS without floppy
  • can I boot DOS from an USB pen drive ?
    URL : There are two ways to prepare a USB drive: either it's formatted like a hard disk, i.e. with an MBR and a partition table, or it's like a superfloppy, i.e. just a plain filesystem.
  • can I boot DOS from a PCMCIA disk ?
  • can I boot DOS from a CD ?
New comands

find - advanced file search with filter

Find is the most powerful DOS command and even more useful than the Windows Desktop Search tool or the Windows Find Wizard. The find command searches for a specific string of text in a file or files. After searching the specified file or files, find displays any lines of text that contain the specified string.

To search your hard disk to find and display the file names on drive C: that contain the string "Google", use the pipe (|) to direct the results of a dir command to find as follows:

dir c:\ /s /b | find "Google"


tree - visual directory structure

You often need to take prints of your physical directory structure but XP has no simple "visual" commands for printing directory contents. Here, try the Tree DOS command and redirect the output to a text file.

tree > mydirectory.txt

print mydirectory.txt


fc - Free BeyondCompare in XP

FC is an advanced DOS Command that compares two files and displays the differences between them. Though the file comparison results are not as interactive as BeyondCompare or Altova DiffDog, fc is still very useful. You can even set fc to resynchronize the files after finding a mismatch.


Useful-windows-xp-dos-commands-tricks
FOR sentence
Runs a specified command for each file in a set of files. FOR %variable IN (set) DO command [command-parameters] %variable Specifies a single letter replaceable parameter. (set) Specifies a set of one or more files. Wildcards may be used. command Specifies the command to carry out for each file. command-parameters Specifies parameters or switches for the specified command. To use the FOR command in a batch program, specify %%variable instead of %variable. Variable names are case sensitive, so %i is different from %I. If Command Extensions are enabled, the following additional forms of the FOR command are supported: FOR /D %variable IN (set) DO command [command-parameters] If set contains wildcards, then specifies to match against directory names instead of file names. FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters] Walks the directory tree rooted at [drive:]path, executing the FOR statement in each directory of the tree. If no directory specification is specified after /R then the current directory is assumed. If set is just a single period (.) character then it will just enumerate the directory tree. FOR /L %variable IN (start,step,end) DO command [command-parameters] The set is a sequence of numbers from start to end, by step amount. So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would generate the sequence (5 4 3 2 1) FOR /F ["options"] %variable IN (file-set) DO command [command-parameters] FOR /F ["options"] %variable IN ("string") DO command [command-parameters] FOR /F ["options"] %variable IN ('command') DO command [command-parameters] or, if usebackq option present: FOR /F ["options"] %variable IN (file-set) DO command [command-parameters] FOR /F ["options"] %variable IN ('string') DO command [command-parameters] FOR /F ["options"] %variable IN (`command`) DO command [command-parameters] filenameset is one or more file names. Each file is opened, read and processed before going on to the next file in filenameset. Processing consists of reading in the file, breaking it up into individual lines of text and then parsing each line into zero or more tokens. The body of the for loop is then called with the variable value(s) set to the found token string(s). By default, /F passes the first blank separated token from each line of each file. Blank lines are skipped. You can override the default parsing behavior by specifying the optional "options" parameter. This is a quoted string which contains one or more keywords to specify different parsing options. The keywords are: eol=c - specifies an end of line comment character (just one) skip=n - specifies the number of lines to skip at the beginning of the file. delims=xxx - specifies a delimiter set. This replaces the default delimiter set of space and tab. tokens=x,y,m-n - specifies which tokens from each line are to be passed to the for body for each iteration. This will cause additional variable names to be allocated. The m-n form is a range, specifying the mth through the nth tokens. If the last character in the tokens= string is an asterisk, then an additional variable is allocated and receives the remaining text on the line after the last token parsed. usebackq - specifies that the new semantics are in force, where a back quoted string is executed as a command and a single quoted string is a literal string command and allows the use of double quotes to quote file names in filenameset. Some examples might help: FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do @echo %i %j %k would parse each line in myfile.txt, ignoring lines that begin with a semicolon, passing the 2nd and 3rd token from each line to the for body, with tokens delimited by commas and/or spaces. Notice the for body statements reference %i to get the 2nd token, %j to get the 3rd token, and %k to get all remaining tokens after the 3rd. For file names that contain spaces, you need to quote the filenames with double quotes. In order to use double quotes in this manner, you also need to use the usebackq option, otherwise the double quotes will be interpreted as defining a literal string to parse. %i is explicitly declared in the for statement and the %j and %k are implicitly declared via the tokens= option. You can specify up to 26 tokens via the tokens= line, provided it does not cause an attempt to declare a variable higher than the letter 'z' or 'Z'. Remember, FOR variables are single-letter, case sensitive, global, and you can't have more than 52 active at any one time. You can also use the FOR /F parsing logic on an immediate string, by making the filenameset between the parenthesis a quoted string, using single quote characters. It will be treated as a single line of input from a file and parsed. Finally, you can use the FOR /F command to parse the output of a command. You do this by making the filenameset between the parenthesis a back quoted string. It will be treated as a command line, which is passed to a child CMD.EXE and the output is captured into memory and parsed as if it was a file. So the following example: FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i would enumerate the environment variable names in the current environment. In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax: %~I - expands %I removing any surrounding quotes (") %~fI - expands %I to a fully qualified path name %~dI - expands %I to a drive letter only %~pI - expands %I to a path only %~nI - expands %I to a file name only %~xI - expands %I to a file extension only %~sI - expanded path contains short names only %~aI - expands %I to file attributes of file %~tI - expands %I to date/time of file %~zI - expands %I to size of file %~$PATH:I - searches the directories listed in the PATH environment variable and expands %I to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string The modifiers can be combined to get compound results: %~dpI - expands %I to a drive letter and path only %~nxI - expands %I to a file name and extension only %~fsI - expands %I to a full path name with short names only %~dp$PATH:I - searches the directories listed in the PATH environment variable for %I and expands to the drive letter and path of the first one found. %~ftzaI - expands %I to a DIR like output line In the above examples %I and PATH can be replaced by other valid values. The %~ syntax is terminated by a valid FOR variable name. Picking upper case variable names like %I makes it more readable and avoids confusion with the modifiers, which are not case sensitive.
Nice sample to discover PCs on a segment

Use this scan :

C:\> FOR /L %i in (1,1,224) do echo **** (%i) **** && ping -w 500 -n 2 192.168.1.%i >> out.txt
CMD file versus Command Line

Variables need to be denoted with two percent signs if being run from a batch file:

c:\Sebas\Rexx\NBTSTAT_scan> type doit.cmd SET SEG=165 FOR /L %%i in (1,1,255) do echo %%i >> %SEG%.txt && nbtstat -A 9.137.%SEG%.%%i >> %SEG%.txt

CRC errors as

H:\ISOs\VS>xcopy d:VS\* Overwrite H:\ISOs\VS\VS.iso (Yes/No/All)? n D:VS\VS.iso File creation error - Data error (cyclic redundancy check).

Is it source ?

H:\ISOs\VS> copy d:VS\VS.iso NUL Data error (cyclic redundancy check). 0 file(s) copied.

If it is, we can try to save as much as possible :

xcopy /c Outlook.pst D:
MQ@DOS
@echo off echo Vigileu que echo NO porta comilles ! SET MQSERVER=SYSTEM.ADMIN.SVRCONN/tcp/192.168.187.136(1414) SET GESTOR=MQ_QM ECHO MQSERVER=%MQSERVER%, Gestor=%GESTOR%. saveqmgrc -s -m %GESTOR% -o -f filename.MQS

Per veure totes les variables d'entorn relacionades amb "MQ" fem :

c:\> set MQ MQFT_JAVA_LIB_PATH=C:\Program Files\IBM\WebSphere MQ\java\lib MQFT_JRE_BIN_PATH=C:\Program Files\IBM\WebSphere MQ\java\jre\bin MQSERVER=SYSTEM.DEF.SVRCONN/TCP/9.137.164.158(2424) MQSI_FILENODES_ROOT_DIRECTORY=c:\MQSIFileInput MQ_FILE_PATH=C:\Program Files\IBM\WebSphere MQ MQ_JAVA_DATA_PATH=C:\Program Files\IBM\WebSphere MQ MQ_JAVA_INSTALL_PATH=C:\Program Files\IBM\WebSphere MQ\Java MQ_JAVA_LIB_PATH=C:\Program Files\IBM\WebSphere MQ\Java\lib MQ_JRE_PATH=C:\Program Files\IBM\WebSphere MQ\java\jre
FOR loop
FOR /L %%V IN (1,1,1201) DO AMQSPUTC QL1 QM1 < fitxer_texte

Gracias, Daniel !

Descr, flags

for /F "tokens=1-2" %%i in (guifi_nodes.txt) do ( @echo ip {%%i} nom {%%j} )

Amb

172.25.66.1 campanar 172.25.66.9 can_coll 172.25.66.17 cementiri

Treu

ip {172.25.66.1} nom {campanar} ip {172.25.66.9} nom {can_coll} ip {172.25.66.17} nom {cementiri}

La mateixa sortida, amb una millora de mes claretat i millor organitzacio :

C:\wget_loop> type guifi_scan.cmd @echo off set nomfitxer=guifi_nodes.txt for /F "eol=; tokens=1-2" %%i in (%nomfitxer%) do call :my_proc %%i %%j goto :my_EOF :my_proc @echo ip {%1} nom {%2} goto :my_EOF :my_EOF
ps -ef @ DOS
tasklist /svc | find "runmqlsr"
DOS pending items
pushd / popd
c:\> pushd /? Stores the current directory for use by the POPD command, then changes to the specified directory. PUSHD [path | ..] path Specifies the directory to make the current directory. If Command Extensions are enabled the PUSHD command accepts network paths in addition to the normal drive letter and path. If a network path is specified, PUSHD will create a temporary drive letter that points to that specified network resource and then change the current drive and directory, using the newly defined drive letter. Temporary drive letters are allocated from Z: on down, using the first unused drive letter found.
beep (when internet connection is lost)
c:> copy con beep.txt [ctrl-G][ctrl-Z][return] c:> type beep.txt

I'va found a tool :

03-06-09 19:47 6.656 WinBeep.exe c:\temp\beep>type WinBeep.txt WinBEEP v0.1 Copyright (c) 2009 by LovePimple Plays a user specified waveform sound. Usage: WinBEEP [sound] Sound parameters can be one of the following values: [1] Standard beep via sound card or internal speaker. [2] The sound specified as the Windows Critical Stop sound. [3] The sound specified as the Windows Asterisk sound. [4] The sound specified as the Windows Question sound. [5] The sound specified as the Windows Exclamation sound. [6] The sound specified as the Windows Default Beep sound. The sounds are set by the user through the Sound control panel application.
DOS Links


Amunt! Top Amunt!
BIOS & HW

Intel hw at PC & BIOS :

Started with an 8250/16550, now it has (emulated maybe) :

port access from C

B Brown

The C language can be used to transfer data to and from the contents of the various registers and controllers associated with the IBM-PC. These registers and control devices are port mapped, and are accessed using special IN andOUT instructions. Most C language support library's include functions to do this. The following is a brief description of how this may be done.

/* #include <conio.h> */ outp( Port_Address, Value ) ; /* turboC uses outportb() */ Value = inp( Port_Address ) ; /* and inportb() */
devices & ports

The various devices, and their port values:

Port Range Device 00 - 0F DMA Chip 8737 20 - 21 8259 PIC 40 - 43 Timer Chip 8253 60 - 63 PPI 8255 (cassette, sound) 80 - 83 DMA Page registers 200 - 20F Game I/O Adapter 278 - 27F Reserved 2F8 - 2FF COM2 378 - 37F Parallel Printer 3B0 - 3BF Monochrome Display 3D0 - 3DF Color Display 3F0 - 3F7 Diskette 3F8 - 3FF COM1
system variables in low memory
0040:0000 Address of RS232 card COM1 0040:0002 Address of RS232 card COM2 0040:0004 Address of RS232 card COM3 0040:0006 Address of RS232 card COM4 0040:0008 Address of Printer port LPT1 0040:000A Address of Printer port LPT2 0040:000C Address of Printer port LPT3 0040:0010 Equipment bits: Bits 13,14,15 = number of printers 12 = game port attached 9,10,11 = number of rs232 cards 6,7 = number of disk drives 4,5 = Initial video mode (00=EGA, 01=CGA40,10=CGA80, 11=MONO) 3,2 = System RAM size 1 = Maths co-processor 0 = Boot from drives? 0040:0013 Main RAM Size 0040:0015 Channel IO size 0040:0017 Keyboard flag bits (byte) 7=ins, 6=caps, 5=num, 4=scrll, 3=ALT, 2=CTRL, 1=LSHFT, 0=RSHFT (toggle states) 0040:0018 Keyboard flag bits (byte) (depressed states) 0040:0019 Keyboard ALT-Numeric pad number buffer area 0040:001A Pointer to head of keyboard queue 0040:001C Pointer to tail of keyboard queue 0040:001E 15 key queue (head=tail, queue empty) 0040:003E Recalibrate floppy drive, 1=drive0, 2=drv1, 4=drv2, 8=drv3 0040:003F Disk motor on status, 1=drive0, 2=drv1, 4=drv2, 8=drv3 80h = disk write in progress 0040:0040 Disk motor timer 0=turn off motor 0040:0041 Disk controller return code 1=bad cmd, 2=no address mark, 3=cant write, 4=sector not found 8=DMA overrun,9=DMA over 64k 10h=CRC error,20h=controller fail, 40h=seek fail,80h=timeout 0040:0042 Disk status bytes (seven) 0040:0049 Current Video Mode (byte) 0040:004A Number of video columns 0040:004C Video buffer size in bytes 0040:004E Segment address of current video memory 0040:0050 Video cursor position page 0, bits8-15=row,bits0-7=column 0040:0052 Video cursor position page 1, bits8-15=row,bits0-7=column 0040:0054 Video cursor position page 2, bits8-15=row,bits0-7=column 0040:0056 Video cursor position page 3, bits8-15=row,bits0-7=column 0040:0058 Video cursor position page 4, bits8-15=row,bits0-7=column 0040:005A Video cursor position page 5, bits8-15=row,bits0-7=column 0040:005C Video cursor position page 6, bits8-15=row,bits0-7=column 0040:005E Video cursor position page 7, bits8-15=row,bits0-7=column 0040:0060 Cursor mode, bits 8-12=start line, 0-4=end line 0040:0062 Current video page number 0040:0063 Video controller base I/O port address 0040:0065 Hardware mode register bits 0040:0066 Color set in CGA mode 0040:0067 ROM initialisation pointer 0040:0069 ROM I/O segment address 0040:006B Unused interrupt occurrences 0040:006C Timer low count (every 55 milliseconds) 0040:006E Timer high count 0040:0070 Timer rollover (byte) 0040:0071 Key-break, bit 7=1 if break key is pressed 0040:0072 Warm boot flag, set to 1234h for warm boot 0040:0074 Hard disk status byte 0040:0075 Number of hard disk drives 0040:0076 Head control byte for hard drives 0040:0077 Hard disk control port (byte) 0040:0078 - 7B Countdown timers for printer timeouts LPT1 - LPT4 0040:007C - 7F Countdown timers for RS232 timeouts, COM1 - COM4 0040:0080 Pointer to beginning of keyboard queue 0040:0082 Pointer to end of keyboard queue Advanced Video Data, EGA/VGA 0040:0084 Number of rows - 1 0040:0085 Number of pixels per character * 8 0040:0087 Display adapter options (bit3=0 if EGA card is active) 0040:0088 Switch settings from adapter card 0040:0089 - 8A Reserved 0040:008B Last data rate for diskette 0040:008C Hard disk status byte 0040:008D Hard disk error byte 0040:008E Set for hard disk interrupt flag 0040:008F Hard disk options byte, bit0=1 when using a single controller for both hard disk and floppy 0040:0090 Media state for drive 0 Bits 6,7=data transfer rate (00=500k,01=300k,10=250k) 5=two steps?(80tk as 40k) 4=media type 3=unused 2,1,0=media/drive state (000=360k in 360k drive) (001=360k in 1.2m drive) (010=1.2m in 1.2m drive) (011=360k in 360k drive) (100=360k in 1.2m drive) (101=1.2m in 1.2m drive) (111=undefined ) 0040:0091 Media state for drive 1 0040:0092 Start state for drive 0 0040:0093 Start state for drive 1 0040:0094 Track number for drive 0 0040:0095 Track number for drive 1 0040:0096 - 97 Advanced keyboard data 0040:0098 - A7 Real time clock and LAN data 0040:00A8 - FF Advanced Video data 0050:0000 Print screen status 00=ready,01=in progress,FFh=error
PC ports

Paralel ports :

port ... LPT3 ... LPT2 ... LPT1 ... data ... 278H ... 378H ... 3BCH ... status ... 279H ... control ... 27AH ...

Serial ports :

port ... COM1 ... 3F8H - 3FFH COM2 ... 2F8H - 2FFH COM3 ... 3E8H - 3EFH COM4 ... 2E8H

LPTx, paralel, entrada i eixida.

Assembly code (at Linux and USB)

Lets display the LPTx: port mappings - see solar

Low profile linux 4 USB

SLAX - 209.315.840 slax-6.1.2.tar

You can get Slax from this website in several formats. Slax for CD is distributed as an ISO image. Burn it to a CD using a special menu option in your burning software, it's usually labeled 'burn CD iso image'. Slax for USB is distributed as a TAR archive. Simply unzip it to your USB device and run bootinst.bat (or bootinst.sh) to make it bootable.

Small damn small

Tiny

Tiny Linux homepage & fix :

edit /boot/sysconfig/sysconfig.cfg replace "bzImage" by "vmlinuz" and "tinycore.gz" by "core.gz"

Great tool : tce-ab : install Open SSH, gcc, binutils (required by as), etc

Code:

sebas@box:~/dos$ cat ver_lpt.c #include char * kVersio = "1.0" ; int main ( void ) { unsigned int * ptraddr ; /* Pointer to location of Port Addresses */ unsigned int address ; /* Address of Port */ int a ; printf ( "BIOS data display. Versio (%s).", kVersio ) ; ptraddr = (unsigned int *) 0x00000408 ; for ( a = 0; a < 3; a++ ) { address = * ptraddr ; if ( address == 0 ) printf ( "No port found for LPT{%d}.\n", a+1 ) ; else printf ( "Address assigned to LPT{%d} is [0x8.8X].\n", a+1, address ) ; * ptraddr ++ ; } ; // for return 0 ; // end of program } ; // main

Abend:

ver_lpt segfault at 408 ip 0804839B sp BF9C3850 error 4 in ver_lpt [8048000+1000]
(minimal) DOS on a USB

Rufus.

Abend:

c:> ver_lpt.exe Invalid Opcode at E672 311C 0213 05B1 0000

We can use mode command .. or GNU DOS or cross-compiler for IOCTL

(complete) DOS on a USB

El proposit és ensamblar "ver_lpt.asm" o tenir un compilador de C per DOS (?).

Video resolution configuration from command line
c:\> type "set resolution.bat" bin\devcon remove *NEC61BE* > logs\output.log bin\devcon remove *IBMA170* >> logs\output.log bin\devcon remove *LEN4033* >> logs\output.log bin\dc -width=1280 -height=1024 -depth=32 >> logs\output.log

Amunt! Top Amunt!
Misteris, dubtes
NET USE strange error

He vist aquest error en fer un "net use" :

"Not enough server storage is available to process this command"
"CD.." strange error

c:\sebas\miscosas\escacs\pgns\$_ya\2018_08_sants>cd.. c:\sebas\miscosas\escacs\pgns\$_ya>cd.. c:\sebas\miscosas\escacs\pgns>cd.. c:\sebas\miscosas\escacs>cd.. c:\sebas\miscosas>cd.. 'cd..' is not recognized as an internal or external command, operable program or batch file. c:\sebas\miscosas>cd .. {compte que hi ha un espai darrere "cd"} c:\sebas>

stack overflow : there was a file named "cd" in "c:\sebas\miscosas" !!!

use CALL in CMD files

If from a CMD we want to call another CMD and to have the control back, we have to use CALL


Modified 20200419 (a)