Anders Danielsson Command Line Utilities

31 August 2017, 382.3 KB.

Manual

ADC - Anders Danielsson Command Line Utilities v1.0.0.37 Copyright © 1988-2017 Scandinavian Digital Systems AB Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------- ADC is a collection of command line utilities ("commands"). Some commands are for general use, and some are for very special usage. Some commands originated as far back as 1988, originally written in ASM, C or C++, now converted to C#. Some commands are new. ADC is written in C#, using .NET Framework. ADC requires Microsoft .NET Framework 2.0 or later to be installed, see "ADC.ReadMe.txt". Common to all commands are: Unicode is supported. Console input and output uses the current code page, and if for example "CHCP 65001" is used, ADC will display and redirect using UTF-8. Most commands support the prefix "\\?\" in pathnames. "\\?\" allows paths longer than 260 characters. ADC supports up to 32767 characters. Syntax: \\?\D:\Path \\?\UNC\Server\Share\Path "\\?\" can only be used with absolute paths, not relative paths. Parent directory ".." and current directory "." may not be used. Usually the ERRORLEVEL is set to 0 on success, and in case of command line errors and other generic errors, the ERRORLEVEL is set to 255. List of available commands: asmdata Preprocessor for data in assembly languages. between Check if current time is between two times of day. bom List files using Byte Order Mark (BOM). bytepatch Search, replace and patch bytes in files. chartab Display tables of code page characters. cmake Execute commands from source code comments. cmdqueue Command queue processor. cmdverify CMD script/batch verify environment and paths. compare Compare two binary files. compdir Compare two directories (drives). cond Conditional list/del/copy of files that exists or not in dir. copydir Copy from a directory to another directory. crc Calculate Cyclic Redundancy Checksum (CRC). culture Display culture information. datetime Display the current date and time. daynumber Convert dates and daynumbers. delall Delete files and/or directories on search masks. delexcess Delete excess files and/or directories. dosftime Search and fix files with non-DOS/FAT file times. dr List files and directories, similar to "dir". errexist Set ERRORLEVEL if file exists. fileopen Test if a file can be opened. files Create or update list of files in text files (Files.txt). filetest Generate random files and measure write/read times. frm Pack firmware files to FRM files. ftpsend Send local files to a FTP server. get Set ERRORLEVEL on key pressed. hex Intel HEX file converter. hexview Displays Intel HEX files in human readable form. hmake Generates C/C++ header files. imgconv Convert an image file to another file with another format. info Display information about the system. log Write to log and maintain log files. makelist Generates list of files for NMAKE. mirror Copy non-equal (changed or new) files. msgbeep Display message with beep until key pressed. newest Display/Copy the newest of two files. numberlist Generate list of numbers. ping Standard Ping (ICMP Echo Request). poi Make Point Of Interest (POI) files and convert different formats. pwdgen Generates passwords. qsort Quick sort text files. rencase Rename files to upper or lower case. search Search text files. sleep Sleep (wait) a time or until key pressed or a file not exists. sound Play sound from WAV file or a Windows system sound. stopwatch Measure the time between start and stop. terminal Serial communication terminal using COM-ports or TCP/IP. test Test ERRORLEVEL and/or if ADC is available for script/batch. textmake Make text files from binary files, images or text lines. textproc Process text files with conditions and variables. touch Set date and time of files. trim Trims text files. txtcode Decodes and encodes text files. udpping Ping using UDP. validarg Validates command line arguments. waitfile Waits until a file exists. Use "adc {command}" for help about a command. Use "adc /h" for help on all commands. Use "adc /m" to create the file "ADC.Manual.txt" (the manual for ADC) in UTF-8 format, with the same content as "adc /h" displays. Latest version of ADC may be downloaded at: http://www.digsys.se/ ------------------------------------------------------------------------------- adc asmdata {asm} {mark} {base} {dst} {src} ... asm Assembler syntax to use. See below. mark String to identify "adc asmdata" lines in the source files. This string must start with the comment character of the assembler, usually ";". The {mark} should be unique for this {dst}. base Name to be used as base of labels in the destination file. The {base} should be unique for this {dst}. dst Destination (target) output file. This file should only be changed by "adc asmdata". It should have a unique {mark} and {base}. src Source input file(s). Wildcards are valid. Hidden and/or system files are ignored. ... Many source files separated with spaces may be used. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc asmdata" is a preprocessor for data in assembly languages. If the source files uses Unicode BOM, the destination file will use the same encoding. Without BOM, the current system Windows ANSI code page will be used on all files. Any BOM mismatches will give an error. The destination output file will only be written to (and get its date and time updated) if there are any changes in the file. {asm} is one of: MPASM Microchip MPASM and MPASMWIN for PIC MCU Source file with "adc asmdata" lines at column 0: {mark} [{name}] [{type} {data}] mark The marker as defined on the command line. The marker starts with the comment character, so the entire line will be like a comment for the assembler. name Name used to make labels of the data. The labels "{name}_ADDR" and "{name}_SIZE" will be created, that may be referenced and used by the ASM code. Use no {name} to continue with more lines with data for the last {name}. type Data storage type, one of: DB, DW, DD, or DQ. {type} and {data} are optional, to create a {name} with data on the following lines. data Data for the type. May be multiple data separated by commas. C/C++ style integers and strings are handled by "adc asmdata", other expressions by the assembler. Strings are surrounded by " or ', and may have C/C++ escape sequences. Strings are always encoded to bytes using the current system Windows ANSI code page. Source file with "adc asmdata" lines not at column 0: [{label}] {name} {mark} {type} {data} label Optional assembly language label not used by "adc asmdata". name Name used to make a macro that calls a user defined macro named "{base}_MACRO" with address and size as arguments. This macro will be executed by the assembler on this line. {name} must be used. mark The marker as defined on the command line. The marker starts with the comment character, so the rest of the line will be a comment for the assembler. type Data storage type, see above. {type} and {data} must be used. data Data for the type, see above. Example of command line: adc asmdata MPASM ";@ASMDATA" OUTPUT txtstr.inc *.asm Example in assembly language source code: INCLUDE "txtstr.inc" ;@ASMDATA Hello DB "Hello World\r\n" MacroPrint Hello_ADDR,Hello_SIZE DebugOutput ;@ASMDATA DB "Debug this\r\n" Result in the file "txtstr.inc" (only vital parts shown): OUTPUT_START EQU $ IF OUTPUT_DATA DB H'48',H'65',H'6C',H'6C',H'6F',H'20',H'57',H'6F' ;0x0000 Hello Wo DB H'72',H'6C',H'64',H'0D',H'0A',H'44',H'65',H'62' ;0x0008 rld\r\nDeb DB H'75',H'67',H'20',H'74',H'68',H'69',H'73',H'0D' ;0x0010 ug this\r DB H'0A' ;0x0018 \n ENDIF ;OUTPUT_DATA OUTPUT_END EQU $ OUTPUT_SIZE EQU $-OUTPUT_START Hello_ADDR EQU OUTPUT_START+H'0000' Hello_SIZE EQU H'000D' DebugOutput MACRO OUTPUT_MACRO OUTPUT_START+H'000D',H'000C' ENDM ------------------------------------------------------------------------------- adc between {time0} [...] [/z{zone}] time0 Time 0 in the format HH:mm:ss. ... Time 1, 2, ..., n. /z Use the time zone specified as hours from UTC, default is the local time of the system. Sets ERRORLEVEL to: 0 Current time < Time 0 1 Current time < Time 1 2 Current time < Time 2 n Current time < Time n n+1 Current time >= Time n 255 Generic error. Example of usage in a script/batch: adc between 04:00:00 08:00:00 if %errorlevel%==0 goto event00to04 if %errorlevel%==1 goto event04to08 if %errorlevel%==2 goto event08to24 goto error_adc ------------------------------------------------------------------------------- adc bom {path} ... [/i{code}|/n{code}] [/s] path Pathname to a directory or a file, wildcards are valid. Hidden and/or system files are ignored. ... Many pathnames separated with spaces is allowed. /i Displays only files with a certain BOM (character encoding), default is to display all files with BOM information. /n Do not displays files with a certain BOM. /s Display found files in sub-directories also. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. {code} is one of: None No Byte Order Mark (BOM). UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). "adc bom" does not do heuristic encoding detection, it only checks for any Byte Order Mark (BOM) in the beginning of the files. Note, if any option is used, but no pathname, then "*" is used. Default is to display all files with Byte Order Mark (BOM) information. Examples: adc bom /s adc bom *.txt /iUTF16LE adc bom /s /nUTF8 *.ashx *.aspx *.cs *.master *.config adc bom /s /nNone *.css *.js *.htm *.html robots.txt *.cmd *.bat ------------------------------------------------------------------------------- adc bytepatch {file} {oper} ... [/q] file File to read and write. oper Operation to perform. ... Many operations separated with spaces may be used. /q Quiet mode. Will not display patches. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Operation syntax: offset=search:replace@count search:replace@count offset=search:replace search:replace offset=replace offset= Start at offset in file, default is to search in the whole file. search: Byte sequence to search for, default is to patch without search. replace Byte sequence to write to the file at found positions. @count Exact number of found matches or 0 meaning any number of matches. Byte sequences are one or more byte values separated by commas. Examples of usage (with comments): adc bytepatch swedish.txt 197:143 196:142 214:153 229:134 228:132 246:148 /q Convert some swedish characters from code page 1252 (ANSI) to 437 (OEM). adc bytepatch bin.lib 0xC6,0x06,0x01,0x01,0xF7:0xC6,0x06,0x01,0x01,0xF3@1 Search a binary file for one match only and replace it. adc bytepatch prog.bin 0x3C3BB=0xF3 Write 0xF3 at position 0x3C3BB in the file "prog.bin". ------------------------------------------------------------------------------- adc chartab {cp} ... [/c] [/p] cp Code page number, 0 is the current code page (CHCP). ... Many code page numbers separated with spaces may be used. /c Sort and display a combined Unicode table of all code pages. /p Make a C# program conversion table. "adc chartab" displays tables of characters 0 - 255 in the wanted code pages. Examples: adc chartab 1252 adc chartab /c 1250 1252 1253 437 850 852 858 ------------------------------------------------------------------------------- adc cmake {src} {cmd} src Source file with $cmake markers. cmd Command with arguments to execute. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. If no BOM then the current system Windows ANSI code page is used. Example: adc cmake hello.cpp nmake /nologo NAME=hello Source file markers in MAK, ASM, C, C++ or C# comment lines at column 3: $cmake {command line arguments} The comment lines must start with "# ", "; " or " ". C++/C# comment lines using "//" cannot be used. For every $cmake found the command is executed. Example: /* $cmake TAR=DOS16 MOD=S $cmake TAR=DOS32 MOD=F */ Will execute two commands: nmake /nologo NAME=hello TAR=DOS16 MOD=S nmake /nologo NAME=hello TAR=DOS32 MOD=F See also "adc hmake" and "adc makelist". ------------------------------------------------------------------------------- adc cmdqueue {queue} [/z{zone}] [/t{min}] [/m] {log} [{max}] [/d] queue Path to command queue file. /z Use the time zone specified as hours from UTC, default is the local time of the system. /t Maximum age of commands in minutes. Default is 1 year. Too old commands are ignored (removed). /m Execute multiple commands if available. log Path to log file or a directory with log files. max When used, then the log file will be shrunk if it is larger than {max} kilobytes. 20% of the first (oldest) lines will be removed. /d Path is a directory with log files for each day, created by "adc log" or "adc cmdqueue". The log files are named "YYYYMMDD.log". When /d is used, then usually {max} is not used. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. The command queue file must have the syntax: yyyy-MM-dd HH:mm:ss Command line with arguments Sets ERRORLEVEL to: 0 No command executed (command queue file is empty). 1 Command executed, may be more commands in queue (unless option /m). 255 Generic error. Example of usage: adc log cmdqueue.txt /t xcopy D:\Files D:\Backup\ /s adc cmdqueue cmdqueue.txt ------------------------------------------------------------------------------- adc cmdverify {level} [/e{env}] [/p{env}] [/o{env}] [/d{dir}] [/m{dir}] [/f{file}] [/v] level Level of validation of the Windows environment, see below. /e Verify that {env} in the environment is defined to anything. /p Verify that {env} in the environment is defined to a valid and existing directory (path). /o If {env} is defined then verify that it is a valid and existing directory (path). /d Verify that {dir} is a valid and existing directory (path). /m Verify and make directory {dir} if it does not exist. /f Verify that {file} is a valid and existing file (path). /v Verbose output, will display all verifications and actions. {level} is one of: 0 Do not verify standard Windows environment 1 Verify the environment variables, using the option: ALLUSERSPROFILE /p APPDATA /o ProgramFiles /o ProgramFiles(x86) /o ProgramW6432 /p TEMP /p TMP /p USERPROFILE /p windir /p 2 As 1, plus the variables for Windows Vista or newer: ProgramData /p PUBLIC /p All environment variables must exist and their values must be valid and existing directories (paths), except for "APPDATA", "ProgramFiles(x86)" and "ProgramW6432" that is optional, but if they exists, they must be valid and existing directories. A valid directory must not have the prefix "\\?\", must not end with "\", must have at least one name, must not contain the names "." and/or ".." and must be rooted (start with "\" or "X:\"). "adc cmdverify" sets ERRORLEVEL to 143 on success and if everything is OK. Typical usage in a CMD script/batch to verify that ADC is installed and available, and that the script is working in a minimum valid Windows environment (line breaks inserted for readability): @echo off setlocal enableextensions if not cmdextversion 2 (echo CMD extensions 2 not available!&exit /b 255) adc cmdverify 1 if not %errorlevel%==143 (echo ADC.EXE is not available or invalid environment!&exit /b 255) ... Another example in a CMD script/batch (line breaks inserted for readability): adc cmdverify 1 /eAPPDATA /eID /d"D:\USR\%ID%" /m"%APPDATA%\ADC" /v if not %errorlevel%==143 (echo ADC.EXE is not available or invalid environment!&exit /b 255) ------------------------------------------------------------------------------- adc compare {file1} {file2} [/b{begin}] [/e{end}] [/q] file1 Binary file 1. file2 Binary file 2. /b Beginning address/position (inclusive), default 0. /e Ending address/position (inclusive), default the largest file. /q Quiet mode. Will not display mismatching bytes. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Compare two binary files within given range. Sets ERRORLEVEL 1 if not equal. Example of usage: adc compare new.bin old.bin /q ------------------------------------------------------------------------------- adc compdir {dir1} {dir2} {except} ... [/n] [/s] [/rf|/ru|/rn] [/a] [/c] [/f{mask}] dir1 Directory 1. dir2 Directory 2. except Optional pathname string exception. If any exception string is found in a part of a pathname, including {dir1} or {dir2}, the file/directory is not compared. End with \ to match a directory. ... Many exceptions may be given. /n Compare not hidden and not system files/directories only. /s Compare file sizes. Include step #2 below. /rf Compare file times using 2 seconds resolution in local time. For FAT16, FAT32, exFAT, ISO 9660 (CDFS), UDF and others. File times are considered equal if the file time difference is less than or equal to 2 seconds ± 1 hour daylight saving. Include step #3 below. /ru Compare file times using 1 second file time resolution in UTC (GMT). For Unix file systems and others, e.g. Network Attached Storage (NAS). File times are considered equal if the file time difference is less than 1 second. Include step #3 below. /rn Compare file times using high precision 100 ns NTFS resolution in UTC (GMT). For NTFS partitions in Windows systems. Include step #3 below. /a Compare file attributes. Include step #4 below. /c Read and compare files byte by byte. Include step #2 and #5 below. /f Only compare files matching {mask}, with/without wildcards. No sub- directories are processed. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc compdir" reports all files in {dir1} that are not equal to files in {dir2}. Compare steps (levels): #1 Check if file exist #2 Check if same file size (only when option /s or /c) #3 Check if same file date/time (only when option /rf or /ru or /rn) #4 Compare file attributes (only when option /a) #5 Read and compare files byte by byte (only when option /c) #6 Extra files/directories in {dir2} Sets ERRORLEVEL bit 1<<(Level-1) on mismatch. Example of usage in a script/batch: @echo off echo Compare D:\Data with E:\Backup\Data adc compdir \\?\D:\Data \\?\E:\Backup\Data /c /rn /a ------------------------------------------------------------------------------- adc cond list {path} ifexist {dir} [{type}] [/s] [/d|/b] adc cond list {path} ifnotexist {dir} [{type}] [/s] [/d|/b] adc cond del {path} ifexist {dir} [{type}] [/s] adc cond del {path} ifnotexist {dir} [{type}] [/s] adc cond copy {path} ifexist {dir} [{type}] [/s] adc cond copy {path} ifnotexist {dir} [{type}] [/s] path File/Directory path, with/without wildcards. dir Existing directory (no wildcards). type Optional file type (including dot) to replace the file type of each found entry of {path} before it is used with {dir}. /s Process found files in sub-directories also. /d The path must be a directory. Default is that the path must be a file. /b The path may both be a file or a directory. If the condition is met at least once then ERRORLEVEL is set to 0 else ERRORLEVEL is set to 1. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. adc cond list {path} ifexist {dir} [/s] [/d|/b] List (display) files and/or directories in {path} that exist in {dir}. adc cond list {path} ifnotexist {dir} [/s] [/d|/b] List (display) files and/or directories in {path} that do not exist in {dir}. adc cond del {path} ifexist {dir} [/s] Delete files (not directories) in {path} that exists in {dir}. adc cond del {path} ifnotexist {dir} [/s] Delete files (not directories) in {path} that do not exist in {dir}. adc cond copy {path} ifexist {dir} [/s] Copy files (not directories) from {path} to {dir} that already exist in {dir}. adc cond copy {path} ifnotexist {dir} [/s] Copy files (not directories) from {path} to {dir} that do not exist in {dir}. Security attributes (ACL) and alternate data streams (ADS) are not copied. Example of usage in a batch/script: @echo off adc cond list SRC\*.CPP ifnotexist BIN .OBJ if %errorlevel%==1 echo All SRC\*.CPP has a BIN\*.OBJ ------------------------------------------------------------------------------- adc copydir {src} {dst} [{file} [...]] [/h] [/q] [/v] src Source directory (path). dst Destination (target) directory (path). file File or sub-directory (sub-path) to copy. Wildcards are valid. If {file} matches a directory, all its files and sub-directories are copied. Default is "*" if no {file} is used. ... Many {file} may be used. /h Copies hidden and system files also. Without option /h hidden and/or system files are ignored. /q Quiet mode, will not display created directories or copied files. /v Verbose mode, will also display number of bytes and times. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc copydir" will copy files from a directory to another directory. Security attributes (ACL) and alternate data streams (ADS) are not copied. If option /v is used, and the console output is not redirected then the [ESC] key may be pressed to terminate the copy. See also "adc mirror". Example of usage in a script/batch (line breaks inserted for readability): @echo off setlocal enableextensions if not cmdextversion 2 (echo CMD extensions 2 not available!&exit /b 255) set NX0=%~nx0 adc cmdverify 1 /dS:\SYS /m"%APPDATA%\ADC" /f"S:\SYS\CMD\%NX0%" if not %errorlevel%==143 (echo ADC.EXE is not available or invalid environment!&exit /b 255) if "%~1"=="BatchCall" goto BatchCall adc copydir S:\SYS\ "%APPDATA%\ADC\" ADC.exe ADC.exe.config "CMD\%NX0%" if not %errorlevel%==0 exit /b 255 cd /D "%APPDATA%\ADC" "CMD\%NX0%" BatchCall exit /b 255 :BatchCall ... ------------------------------------------------------------------------------- adc crc {src} src Source input file. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Calculates Cyclic Redundancy Checksums (CRC) and other checksums of a file. Example of usage: adc filetest test.bin 16 adc crc test.bin ------------------------------------------------------------------------------- adc culture {cult|-|.|*} [/n] [/a] [/v] cult Culture to display, e.g. "en-US". - Display the invariant culture. . Display the current user default culture. ! Display the installed user interface localized culture. * Display list of all available cultures. /n Display neutral cultures, default is specific cultures, when using *. /a Display abnormal cultures only, when using *. /v Display verbose output, when using *. "adc culture" displays information of cultures in the C# .NET Framework. Displayed strings, such as date and time formats, will use caret ^ escape sequences on special and white space charaters: ^t Tab ^s Soft Space (normal space) ^h Hard Space (non-break space) ^n New Line ^^ Caret ^XXXX Unicode character with hexadecimal code XXXX ------------------------------------------------------------------------------- adc datetime {form} [/c{cult}] [/z{zone}] [/t{text} ...] form C# date and time format of output, see: http://msdn.microsoft.com/en-us/library/az4se3k1 Use the escape sequence #HHHH for Unicode characters whose code is hexadecimal HHHH. Escape sequences #HHHH are processed first. Additional format specifiers used by "adc datetime" only: C0 "yyyyMMddHHmmss" L0 "yyyy'-'MM'-'dd HH':'mm':'ss" H0 "yyyy'-'MM'-'dd HH':'mm':'ss'.'fffffff" /c Use the culture {cult} with the C# format, see "adc culture". If /c alone (no {cult}) then the current user default culture is used. Without option /c the invariant culture is used. /z Use the time zone specified as hours from UTC, default is the local time of the system. /t Any text that will be outputed after the date/time. /t must be the last argument, everything following /t will be used. Use the escape sequence #HHHH for Unicode characters whose code is hexadecimal HHHH. Useful #HHHH escape sequences in {text} and {form}: #0009 Tab character #0022 Quotation mark " #0023 Number sign # #0025 Percent sign % #0026 Ampersand & #002F Forward slash / #003C Less-than sign < #003E Greater-than sign > #005E Caret ^ ## Number sign # "adc datetime" displays the current date and time. Examples: adc datetime F adc datetime g /cen-US adc datetime R /z0 adc datetime L0 /z-3.5 /t At GMT-03:30 Example of usage in a script/batch (line breaks inserted for readability): @echo off set UTC=ERROR for /F "usebackq tokens=* delims=" %%A in (`adc datetime C0 /z0`) do set UTC=%%A echo %UTC% ------------------------------------------------------------------------------- adc daynumber {type} [value] [/c{chr}] [/e{div}] type Type of input value: Local Current local date, no [value] is used UTC Current UTC date, no [value] is used Date Gregorian date in ISO 8601 format: ±YYYY-MM-DD Week Gregorian date in ISO 8601 format without 'W': ±YYYY-ww-D Day Gregorian date in ISO 8601 format: ±YYYY-DDD Julian Julian date in ISO 8601 format: ±YYYY-MM-DD XDN eXtended Day Number, positive integer, used internally JDN Julian Day Number, starts on Julian date 4713 BC Jan 1 RDN Rationalized Day Number, starts on 0001-01-01 WIN Day number of Windows NT file time, starts on 1601-01-01 MJD Modified Julian Day, starts on 1858-11-17 value Input value to convert, see above. /c Output one single line with {chr} as separator (delimiter). Use a character or a Unicode number. Default is /c32 (space). Outputs: ±YYYY MM DD ±YYYY ww D DDD RDN /e Set ERRORLEVEL to RDN % {div}, e.i. to the remainder of the division of RDN by {div}, RDN modulo {div}. 0 < {div} < 256. "adc daynumber" converts different date and day numbers. Examples: adc daynumber date 2011-11-07 adc daynumber rdn 734447 Example of usage in a script/batch (line breaks inserted for readability): @echo off for /F "usebackq tokens=1-8" %%A in (`adc daynumber local /c`) do (echo Date: %%A-%%B-%%C &echo Week: %%D-W%%E-%%F &echo Day: %%A-%%G &echo RDN: %%H) Another example: @echo off adc daynumber local /e7 if %errorlevel%==0 echo Monday if %errorlevel%==1 echo Tuesday if %errorlevel%==2 echo Wednesday if %errorlevel%==3 echo Thursday if %errorlevel%==4 echo Friday if %errorlevel%==5 echo Saturday if %errorlevel%==6 echo Sunday ------------------------------------------------------------------------------- adc delall {path} [/s] [/r] [/d{mask}] [/f{mask}] [/b{mask}] ... [/x] path Base path (directory). /s Search in all subdirectories also. /r Register the delete of all files and directories on the next reboot. Only on Windows 2000 or later. Cannot be used on network shares. "\\?\" support only on Windows XP or later. mask File/Directory mask, with/without wildcards. /d Search and delete only directories (not files) matching mask. /f Search and delete only files (not directories) matching mask. /b Search and delete both files and directories matching mask. ... Many masks separated with spaces are allowed. /x Execute delete. Without option /x, the files and directories are only displayed and not deleted. Only when /x is used will they be deleted. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Example commands: Description and comments: adc delall C:\ /s /fproj.err Display all proj.err found on entire C: adc delall D:\ /s /btmp.* /b*.tmp Display all temporary files and dirs on D: adc delall C:\Doc /f"kill me.*" /x Delete all "kill me" files in C:\Doc adc delall C:\ /r /dTMP /x Delete the C:\TMP dir on the next reboot ------------------------------------------------------------------------------- adc delexcess {path} {count} [/n] [/d] [/z] [/r] [/x] path Pathname to a directory or a file, wildcards are valid. count If {count} > 0 then number of found files/directories to keep. If {count} <= 0 then delete all files older than -{count} days and ignore options /n. /n Use sorted (ordinal Unicode) file names instead of file dates/times. /d The path must be a directory. Default is that the path must be a file. /z Zero size files (no /d) or empty directories (when /d) are not counted and always deleted. /r Register the delete of files and directories on the next reboot. Only on Windows 2000 or later. Cannot be used on network shares. "\\?\" support only on Windows XP or later. /x Execute delete. Without option /x, the files and directories are only displayed and not deleted. Only when /x is used will they be deleted. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc delexcess" will keep the newest {count} number of files (or directories), and delete all excess old files. Or if {count} < 0 then "adc delexcess" will keep all files up to -{count} days old. Examples: adc delexcess C:\BackupFiles\Day.*.zip 30 /z /x adc delexcess C:\BackupFolders\* 10 /n /d /x adc delexcess OnlyToday*.log 0 /x adc delexcess Previous7Days*.log -7 /x ------------------------------------------------------------------------------- adc dosftime {path} ... [/s] [/a] [/x] path Pathname to files, wildcards are valid. ... Many pathnames separated with spaces is allowed. /s Search in subdirectories also. /a Check and modify all time values: Create, Last-Access and Last-Write Without /a, only the Last-Write time is checked and modified. /x Execute date/time changes. Without option /x, the files are only displayed and not modified. Only when /x is used will they be modified. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Searches for files with non-DOS/FAT file date and times, and when /x is used, rounds the Last-Write and Create times to be an even number of whole seconds or nearest date for the Last-Access times. All dates are made within the limits January 1, 1980 to December 31, 2107. Examples: adc dosftime C:\Doc\*.txt /s /x ------------------------------------------------------------------------------- adc dr {path} ... [/t{text}] [/d] [/f] [/s] [/i] [/a{attr}] [/r{form}] [/c{cult}] [/z{zone}] [/w{dst}] [/o{code}] [/n] [/u] path Pathname to a directory or a file, wildcards are valid. ... Many pathnames separated with spaces is allowed. /d Displays only directories (with no '\' after the directory names). /f Displays only files (not directories). /s Matching files in subdirectories are displayed. /i Displays file info, such as size, attributes, date, etc. This is almost the same as using /t"$p $s $a $d$!", but with $p left-aligned by 56 characters and with optional short file name at the end of the line. attr File/Directory attributes to match, see below. form C# date and time format, see: http://msdn.microsoft.com/en-us/library/az4se3k1 Use the escape sequence #HHHH for Unicode characters whose code is hexadecimal HHHH. Escape sequences #HHHH are processed first. Additional format specifiers used by "adc dr" only: C0 "yyyyMMddHHmmss" L0 "yyyy'-'MM'-'dd HH':'mm':'ss" H0 "yyyy'-'MM'-'dd HH':'mm':'ss'.'fffffff" Default is H0. /c Use the culture {cult} with the C# format, see "adc culture". If /c alone (no {cult}) then the current user default culture is used. Without option /c the invariant culture is used. /z Use the time zone specified as hours from UTC, default is the local time of the system. dst Optional destination output text file. If no {dst} is used, or if {dst} is "CON", the output goes to the console and the options /o, /n and /u are ignored. /o Output character encoding of {dst}. Default is the current system Windows ANSI code page. /n Do not add a Byte Order Mark (BOM) to {dst}. /u Write Unix newlines instead of Windows newlines to {dst}. Special $ character sequences in {text}: $p Pathname $q Pathname within " and " $f Filename with extension, without path $n Filename without path and extension $s Size of file, or the text "DIR" $a Attributes of file $d Date and time of file $! Newline $$ Dollar sign $ Useful #HHHH escape sequences in {text} and {form}: #0009 Tab character #0022 Quotation mark " #0023 Number sign # #0025 Percent sign % #0026 Ampersand & #002F Forward slash / #003C Less-than sign < #003E Greater-than sign > #005E Caret ^ ## Number sign # {attr} is one or more letters of: Attribute: On: Off: Archive A N Read Only R W Hidden H V System S O Compress C U Encrypt E D Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Note, if any option is used, but no pathname, then "*" is used. Default is to display all files and directories without info. Examples: adc dr /i /z0 c:\sys\* adc dr *.txt /f /t"call procfile $q$!">temp.cmd adc dr \\?\C:\VeryLongPathExistsHere\* /s /aHS adc dr EXP\*.png /t"$d $n$!" /rL0 /wListPng.txt /oUTF8 ------------------------------------------------------------------------------- adc errexist {path} [/z] [/d|/b] [/t{time}] [{except} ...] path Pathname to a directory or a file, wildcards are valid. If any file exists then ERRORLEVEL is set to 1 else ERRORLEVEL is set to 0. /z Zero size files are treated as non existing. /d The path must be a directory. Default is that the path must be a file. /b The path may both be a file or a directory. time Time in the format HH:mm:ss. Files older than {time} are treated as non existing (ignored). except Optional name string exception. If a found file name is equal to the exception string, the file is ignored as if it does not exist. ... Many exceptions may be used. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Example of usage in a batch/script: adc errexist TMP\MyProj.ERR /z if errorlevel 1 goto error Another example in a batch/script: adc errexist D:\Process\* /t48:00:00 SETUP.TMP if %errorlevel%==1 goto process ------------------------------------------------------------------------------- adc fileopen {path} [/w] [/q] [{sec}] [{loop}] [/u] path Pathname to files to open, wildcards are valid. /w Open files using write access, default is read access. /q Quiet mode. Will not display files and error messages. sec Seconds to keep each file opened, default is 0 seconds. loop Loop count to repeat the whole process. /u Enable user [ESC] key, terminates with ERRORLEVEL 2 if user press the [ESC] key. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Test if the files can be opened. Sets ERRORLEVEL 0 on success of all files. Sets ERRORLEVEL to 1 on first error. Example: adc fileopen D:\Proc\Running.log ------------------------------------------------------------------------------- adc files {dir} [{lst}] dir Pathname to a directory with files and directories to list. lst Filename of a text file in {dir} to read and write, default is to use "Files.txt". Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Creates or updates a list of files in a text file (Files.txt). Names of files and/or directories must be in the begining on each line in the text file. Spaces in names are converted to '_'. Hidden and/or system files are ignored. Example: adc files D:\DVD\Drivers Drivers.txt ------------------------------------------------------------------------------- adc filetest {file} [{size}] [{num}] file File to create with random data. size Optional size in MB (x 1048576 bytes). If size is used then the file will be kept and not deleted. Max size is 8388608 (8 TB). num Number of files to create, each file name will get a number postfix. E.g. if "MyFile.Bin" is used, then "MyFile01.Bin" to "MyFile10.Bin" will be created if {num} is 10. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. If no {size} is used then "adc filetest" measures the write and read times of random data to the specified file. Data is written during 2 minutes, but not less than 1 MB and not more than 8 TB or until the drive is full. Time is limited to 10 minutes. It may be used to test and measure hard disks, networks, USB memories, etc. The file is then deleted. If {size} is used then "adc filetest" only writes random data to the file and exits with the file kept. Example of usage: adc filetest G:\test.bin adc filetest random.bin 256 adc filetest random.bin 1024 4 ------------------------------------------------------------------------------- adc frm {cmd} ... cmd Command, one of C, V, E, or O. See below. ... Options for the command. "adc frm" is a firmware packer, intended for low level embedded systems and similar, with low capacity to manage files. It packs multiple files together into one FRM file, to be transported/distributed to devices/clients. adc frm C {frm,cid,pid,rel} {file,mthd,fid} ... frm FRM file to create. cid Company identification (32-bit integer). pid Product identification (32-bit integer). rel Release number (32-bit integer). file File to put in FRM file (no wildcards). mthd Method of storage: 0 Compression No / Encryption No 1 Compression Yes / Encryption No 2 Compression No / Encryption Yes 3 Compression Yes / Encryption Yes fid File identification (32-bit integer). Must be unique within the FRM. ... Many "{file,mthd,fid}" may be used. Example: adc frm C ACME.FRM,13,147,4 PIC.02.BIN,3,2 CPU.BIN,3,1 adc frm V {frm} frm FRM file to view and test. Example: adc frm V ACME.FRM adc frm E {frm} [{path}] frm FRM file to extract the files from. path Destination path, default is the current directory. The files are named "{fid}.FIL", where {fid} is the eight digit hexadecimal number from "adc frm C" above. Example: adc frm V ACME.FRM D:\Files adc frm O {frm,0,pid,0} {file,mthd,fid} ... Same as 'C' but using an old and obsolete revision of the FRM file. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. ------------------------------------------------------------------------------- adc ftpsend {ftp} {src} {dst} [{except} ...] [/f{mask}] [/m] [/b{busy}] [/l{log}] [/o{code}] [/z{zone}] [/a] [/v] ftp Text file with FTP configurations, see below. src Local source path (directory) of files to send (copy). dst FTP server destination directory, relative to the root directory. Use "." if the destination directory is the same as the root directory. except Optional pathname string exception. If any exception string is found in a part of a local source pathname, the file or directory is not sent. End with \ to match a directory. ... Many exceptions may be used. /f Only send files matching {mask}, with/without wildcards. No sub- directories are processed. Multiple /f may be used. /m After a successful file copy, the file is deleted on the local source. Then processed sub-directories will also be deleted. This will be like a safe "move" of the files. /b Start by sending the busy file {busy} to {dst}. When everything is done without any errors, the busy file at {dst} is removed. /l Write log to file {log}, default is to output to the screen only. /o Output character encoding of the log file. Default is the current code page (CHCP). /z Use the time zone specified as hours from UTC, default is the local time of the system. /a Append to the log file, keeping any existing BOM and encoding. Default is to overwrite if file exist, ignoring any existing BOM. /v Verbose output, will display all FTP commands and responses. {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is the current code page (CHCP). Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc ftpsend" sends local files to a FTP server. Hidden and/or system files are not sent. All not hidden and not system sub-directories are processed, unless option /f is used. The {ftp} file contains at least four lines with: 1 Host name or IP address, with optional comma and port number (default 21). 2 Login username. 3 Login password. 4 Remote FTP root directory (combined with {dst}). 5 File extension that uses the ASCII mode transfer, e.g.: .pl . Many lines with file extensions may be used. If no BOM then the current system Windows ANSI code page is used. Example of usage: adc ftpsend mysite.ftp D:\WEB\mysite\ httpdocs\ /bD:\WEB\App_Offline.htm Example of "mysite.ftp": ftp.mysite.com mylogin mypassword \ .pl .cgi .t ------------------------------------------------------------------------------- adc get {chars} [/b{sec}] [/e{sec}] /t chars String of characters to accept as keyboard inputs. /b Seconds between beeps. /e Seconds until exit. /t Test and display a key input. On exit ERRORLEVEL is set to the position of the inputed character in the string of characters. The comparision is case insensitive. Escape sequences in the string of characters: \n Enter \r Enter \t Tab \v Ctrl-J or Ctrl-Enter \b Backspace \f Ctrl-L \a Ctrl-G \e Escape \\ Backslash \uhhhh Unicode character whose code is hexadecimal hhhh \xhh Extended key whose code is hexadecimal hh \o Refer to all other keys not specified in the character string Use \u0022 for the quotation mark ". Use \u002F for the forward slash / (if the first character). Use option /t to get the character or escape sequence to use. If option /e is used, ERRORLEVEL is set to 254 after {sec} seconds. In case of any errors, ERRORLEVEL is set to 255. Example of usage in a batch/script: @echo off echo Continue (Y/N)? adc get "YN" /b6 if %errorlevel%==1 goto yes if %errorlevel%==2 goto no goto error ------------------------------------------------------------------------------- adc hex {mem},... /s{src},{opt},... /d{dst},{opt},... mem Memory areas and options, see below. /s Source input file {src} with options {opt}. /d Destination output file {dst} with options {opt}. ... Many options may be used separated by commas. Many /s and /d may be used, to read multiple input files, and to write multiple output files. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc hex" is an Intel HEX file converter. It follows these steps: 1) Allocate memory areas and fill with byte values. 2) Read all input sources (HEX files and/or binary files). 3) Patch single byte values in the memory areas. 4) Adjust memory area sizes (limits). 5) Special memory area processing. 6) Calculate checksums. 7) Write all output destinations (HEX files and/or binary files). Options for "{mem},...", # is memory area number (1, 2, 3, etc): a#=A-B Address range of memory area # from A to B (inclusive). This must be specified for any used memory area #. No memory area may overlapp another. Addresses A and B may be within 0 and 0xFFFFFFFF, but the size B - A + 1 must be less than 0x80000000 (2 GB). f#={value} Byte value to fill memory with, default 0xFF when only "f#", or use "f#=RND" for random values. If no "f#" is used then the memory is filled with 0x00. The random values uses a fixed seed and restarts on each "a#", so the results are repeatable. p={a}:{v} Patch the byte at address {a} with the value {v} after reading all "/s{src},{opt},...". Many "p" may be used. The address {a} must be within any of the defined "a#=A-B" memory areas. d#={dynamic} Change memory area limits A and B dynamically. {dynamic} may be: DYNLOW Increase limit A DYNHIGH Decrease limit B DYNRANGE Increase/Decrease both limits A and B After all "/s{src},{opt},..." have been read and after all patches have been done, the limits A-B will be shrunk to fit the actual used memory area. All references to the shrunken parts done by options "c={c}/C:D-E", "o#=I-J" and "p=K" will be adjusted accordingly. Note, if a default value for C is used in an area with decreased limit B, the source input must include the checksum storage bytes. s#={special} Special memory areas processing. {special} may be one of: BOOTWARE PIC Bootware Serial Protocol Rev 01 BOOTWR08 PIC Bootware Serial Protocol Rev 08 PICWARE4 PIC Boot and Firmware Rev 4 When using these, all checksum calculations needed by the firmware are automatically done and normally no "c" parameters for this memory area are needed. See also other documentations. c={c}/C:D-E Calculate checksum of address range D to E (inclusive) and store it at address C. Many "c" may be used, the addresses C, D and E must be within any of the defined "a#=A-B" memory areas. "-E", "D-E" or "/C:D-E" may be omitted. C is by default the highest B minus the checksum storage size, D is by default the lowest A or the previous C plus the checksum storage size if many "c" are used, E is by default the address C-1. If the range D-E crosses many "a#=A-B" memory areas, then the calculation skips over any empty spaces between them. {c} is one of: SUM16LE, CRC16LE, FCS16LE, CRC32LE, SUM16BE, CRC16BE, FCS16BE, CRC32BE Where LE is Little Endian (Windows/Intel) and BE is Big Endian (Unix/Motorola). See also "adc crc". The calculations are done after reading all "/s{src},{opt},..." and after all patching. Options for "/s{src},{opt},...", # is memory area number (1, 2, 3, etc): t={type} Type of input file HEX or BIN. Default is HEX. i#=F-G Input address range from F to G (incl) to memory area #. "i#" must be specified to tell what memory area # to use, but "=F-G" may be omitted to use A-B from the memory options. If not "t=BIN" then multiple "i#" may be used, to read into different memory areas or different parts of the same memory area. If "t=BIN" then the binary file must have the size H + G - F + 1 or an error is reported, unless "u" is used. m=H Move (translate) from input file address/position H to F within the last defined range F-G. If no "m" is used then no move is done, that is for HEX files H = F and for BIN files H = 0. Parameter "m" must be specified immediately after "i#". u Unwanted and unused data outside all "i#=F-G" will be silently discarded without any error messages if "u" is used. Options for /d{dst},{opt},..., # is memory area number (1, 2, 3, etc): t={type} Type of output file HEX8, HEX16, HEX32 or BIN. Default is BIN. HEX8 Intel HEX with 16-bit addresses (max 64 KB) HEX16 Intel HEX with 20-bit addresses (max 1 MB) HEX32 Intel HEX with 32-bit addresses (max 4 GB) Usually is only "t=BIN" or "t=HEX32" used. HEX8 and HEX16 should only be used if absolutely necessary. r={value} Reduce HEX file output by removing lines with only bytes equal to {value}, default 0xFF when only "r". This is not possible when "t=BIN". f={value} Byte value to fill BIN file with, default 0xFF when only "f", or use "f=RND" for random values. If no "f" is used then the BIN file is filled with 0x00. The random values uses a fixed seed and restarts on each "o#", so the results are repeatable. This option is not used when not "t=BIN". o#=I-J Output memory area # range I-J to the output file. "o#" must be specified to tell what memory area # to use, but "=I-J" may be omitted, I-J is by default A-B. Multiple "o#" may be used, to write from different memory areas or different parts of the same memory area, even when "t=BIN". If for example, using "t=BIN" with only one "o#" then a binary file will be created with the size K + J - I + 1, where the first K bytes are jumped over and filled as defined by "f" above. Special option is "o#=PICWARE4", when automatic detection of firmware addresses I-J has been done by using memory option "s#=PICWARE4". p=K Output position (address, offset) in the output file for the last defined range I-J. If no "p" is used, then K is by default 0 or the next output position if many "o#" are used. Parameter "p" must be specified immediately after "o#". Example for C165 MCU, line breaks and comments inserted: a1=0x000000-0x0007FF, Interrupt vectors and code in RAM a2=0x200800-0x203FFF, Code in ROM, part I a3=0x208000-0x23FFFF, Code in ROM, part II f1,f2,f3, Fill with 0xFF c=CRC16LE CRC of all areas stored at 0x23FFFE /sC165.HEX, Input "C165.HEX" i1,i2,i3 Input to all memory areas /dC165.BIN, Output "C165.BIN" o1, Output memory area 1 at file offset 0x0000 o2, Output memory area 2 at file offset 0x0800 o3 Output memory area 3 at file offset 0x4000 Example for PIC18, line breaks and comments inserted: a1=0x000000-0x003FFF, Program flash area (16 KB) f1=RND, Fill with random bytes a2=0x200000-0x200007, Identification area f2, Fill with 0xFF a3=0x300000-0x30000F, Configuration area f3, Fill with 0xFF c=CRC32LE/0x11FC, CRC of 0x0000-0x11FB stored at 0x11FC c=CRC32LE/0x3FBC, CRC of 0x1200-0x3FBB stored at 0x3FBC c=CRC32LE/0x3FFC CRC of 0x3FC0-0x3FFB stored at 0x3FFC /sPIC18.HEX, Input "PIC18.HEX" i1,i2,i3 Input to all memory areas /dPICPROG.HEX, Output "PICPROG.HEX" t=HEX32, Format HEX32 o1,p=0x000000, Output memory area 1 using address 0x000000 o2,p=0x200000, Output memory area 2 using address 0x200000 o3,p=0x300000 Output memory area 3 using address 0x300001 /dPICPROG.P.BIN,o1 Output program binary file from area 1 /dPICPROG.I.BIN,o2 Output identification binary file from area 2 /dPICPROG.C.BIN,o3 Output configuration binary file from area 3 Example of combining two inputs, line breaks and comments inserted: a1=0x80000-0xBFFFF, Total range in EPROM (256 KB) f1, Fill with 0xFF p=0xBDA67:5, Patch the byte at 0xBDA67 to the value 5 p=0xBFFFA:0,p=0xBFFFB:0 Patch the checksum location at 0xBFFFA to 0 c=SUM16LE/ 0xBFFFA:0x80000-0xBFFFF Checksum of 0x80000-0xBFFFF stored at 0xBFFFA /sTOS.HEX,i1 Input file 1 to memory area 1 /sPRG.HEX,i1 Input file 2 to memory area 1 /dEPROM.HEX, Output "EPROM.HEX" t=HEX16, Format HEX16 r, Reduce HEX file by removing lines with 0xFF o1 Output memory area 1 to offset (address) 0 See also "adc hexview". ------------------------------------------------------------------------------- adc hexview {src} [{dst}] [/o{code}] [/n] [/u] src Source input Intel HEX file. dst Optional destination output text file. If no {dst} is used, or if {dst} is "CON", the output goes to the console and the options /o, /n and /u are ignored. /o Output character encoding of {dst}. Default is the current system Windows ANSI code page. /n Do not add a Byte Order Mark (BOM) to {dst}. /u Write Unix newlines instead of Windows newlines to {dst}. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is current code page (CHCP). "adc hexview" reads any Intel HEX file and displays it in human readable form. Example of usage: adc hexview PIC18.HEX See also "adc hex". ------------------------------------------------------------------------------- adc hmake {dst} {src} ... dst Destination (target) C/C++ header file. This file should only be changed by "adc hmake". src Source input file(s). Wildcards are valid. Hidden and/or system files are ignored. ... Many source files separated with spaces may be used. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. If the source files uses Unicode BOM, the destination header file will use the same encoding. Without BOM, the current system Windows ANSI code page will be used on all files. Any BOM mismatches will give an error. The destination header file will only be written to (and get its date and time updated) if there are any changes in the file. Example of usage in a makefile for NMAKE: !if [adc hmake include\string.h string\*.asm string\*.c]!=0 !error adc hmake error !endif # "include\string.h" is now created and may be used as dependent file. Source file markers in MAK, ASM, C, C++ or C# comment lines at column 3: $hmake Start marker for lines to put in header file. $c Optional comment section to put in header file. $ End marker. The comment lines must start with "# ", "; " or " ". C++/C# comment lines using "//" cannot be used. See also "adc cmake" and "adc makelist". ------------------------------------------------------------------------------- adc imgconv {src} {dst} {frm} src Source input image file. dst Destination output image file. frm Optional output format: bmp, gif, jpg, png, tiff Default is to use the dst file extension or jpg if no extension match. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Converts an image file to another file with another format. Example of usage: adc imgconv inpic.bmp outpic.png ------------------------------------------------------------------------------- adc info ... [/f] ... Any command line arguments. /f Full info, including special folders. Displays information about the system and ADC. See also "adc culture" and "adc datetime". Examples: adc info . adc info ComSpec=%ComSpec% /f ------------------------------------------------------------------------------- adc log {path} [{max}] [/d] [/o{code}] [/z{zone}] [/n] [/h{hide}] [/f{src}] [/e] [/t{text} ...] path Path to log file or a directory with log files. max When used, then the log file will be shrunk if it is larger than {max} kilobytes. 20% of the first (oldest) lines will be removed. /d Path is a directory with log files for each day, created by "adc log". The log files are named "YYYYMMDD.log". See also "adc delexcess". When /d is used, then usually {max} is not used. /o Output character encoding of the log file. Default is the current code page (CHCP). /z Use the time zone specified as hours from UTC, default is the local time of the system. /n Append one new empty line to the log file (before /f and/or /t). Many /n may be used, for many empty lines. /h Hide the first {hide} lines of /f from being outputted to the console. The number {hide} is optional, /h alone will hide all lines. /f Source file to read and append non-empty lines to the log file. Many /f may be used, they will be appended in order. /e Use escape sequences #HHHH in {text} for Unicode characters whose code is hexadecimal HHHH. Without option /e no #HHHH are translated. /t Any text that will be appended to the log file as one line with date and time in ISO 8601 format. /t must be the last argument, everything following /t will be used as text. {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is the current code page (CHCP). Useful #HHHH escape sequences in {text} when option /e is used: #0009 Tab character #0022 Quotation mark " #0023 Number sign # #0025 Percent sign % #0026 Ampersand & #002F Forward slash / #003C Less-than sign < #003E Greater-than sign > #005E Caret ^ ## Number sign # Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Example of usage: adc log ftp.log /z0 4096 /n /n /t Starting FTP ftp -v -i -s:script.ftp>ftp.tmp adc log ftp.log /z0 /fftp.tmp /t FTP Done adc log App_Data\Log /z0 /d /oUTF8 /e /t"#0009-#0009-#0009-#0009Compile" ------------------------------------------------------------------------------- adc makelist {label} {dir} {files} {ext} {output} {except} ... label Makefile label to define in the output file. dir Directory (path) to put in front of all found files. The directory will be created if it does not exist. files File mask (with path) of files to find. Hidden and/or system files are ignored. ext Extension to change to of all found files. output File to create and write label definitions to, using the current system Windows ANSI code page. except Optional (complete) file name that should not be included. ... Many exceptions may be used. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Example of usage in a makefile for NMAKE: !if [adc makelist ASMFILES tmp *.asm obj tmp\asmfiles.mak]!=0 !error adc makelist error !endif !include tmp\asmfiles.mak The file "tmp\asmfiles.mak" will contain one line, for example: ASMFILES = tmp\file1.obj tmp\file2.obj tmp\file3.obj See also "adc cmake" and "adc hmake". ------------------------------------------------------------------------------- adc mirror {master} {slave} [{except} ...] [/c|/d|/a] [/t] [/rf|/ru|/rn] [/ne] [/f{mask}] [/u] [/e] [/p] [/b{sec}] master Path of master (directory). slave Path of slave (directory). Directory will be created if not exist. except Optional pathname string exception. If any exception string is found in a part of a pathname, including {master} or {slave}, the file/directory is not mirrored. End with \ to match a directory. If {except} starts with {master} or {slave} (followed by a \) then the exception string is used only on master or slave paths and must match a full (rooted) path, not just any part of a pathname. This will be executed faster than not rooted exceptions. If {except} starts with "*" then two exception strings are added, with "*" replaced by {master} and {slave} respectively (followed by a \). ... Many exceptions may be used. /c Copy files from slave that are new/newer instead of prompting. /d Delete/Overwrite files on slave that are new/newer instead of prompting. /a Ask (prompt) on all actions. Without option /a then all new/newer files on the master are copied/overwritten to the slave without promting. /t Create test file "{master}\!mirror!.txt" with time stamp. /rf Use 2 seconds file time resolution in local time. For FAT16, FAT32, exFAT, ISO 9660 (CDFS), UDF and others. File times are considered equal if the file time difference is less than or equal to 2 seconds ± 1 hour daylight saving. This is the default. /ru Use 1 second file time resolution in UTC (GMT). For Unix file systems and others, e.g. Network Attached Storage (NAS). File times are considered equal if the file time difference is less than 1 second. /rn High precision 100 ns NTFS file time resolution in UTC (GMT). For NTFS partitions in Windows systems. For backward compatibility, option /h is the same as /rn. /ne Force all files to be non-equal. Files that are equal will be treated as if the master is newer. /f Only mirror files matching {mask}, with/without wildcards. No sub- directories are processed. Multiple /f may be used. /u Update existing files only. Only files that exists at both master and slave are processed. /e Pause/Prompt at errors (only). /p Always do pause/prompt at end or at errors. /b Seconds between beeps at prompts. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc mirror" will copy non-equal (changed or new) files. Files are considered equal if the file sizes and times are equal. Hidden and/or system files are not mirrored. All not hidden and not system sub-directories are processed, unless option /f. Security attributes (ACL) and alternate data streams (ADS) are not copied. If the console output is not redirected then the [ESC] key may be pressed to terminate the mirror. Examples: adc mirror D:\Doc S:\Doc /rn adc mirror G:\ E:\BACKUP_G /d /t /e adc mirror \\?\D:\ \\?\E:\Mirror\ \\?\D:\LocalData\ /ru /d /t /b6 adc mirror C:\ D:\ *Windows\ /rn See also "adc copydir". ------------------------------------------------------------------------------- adc msgbeep {sec} {msg} sec Seconds between beeps or 0 for no beeps. msg Message to display, that will be erased after any key pressed. Example: adc msgbeep 6 "Press any key to continue ! " ------------------------------------------------------------------------------- adc newest {file1} {file2} [{target} [...]] [/rf|/ru|/rn] file1 File 1. file2 File 2. target Copy the newest of {file1} or {file2} to {target}. If {target} is not used then "adc newest" will only display what file is the newest. ... May groups of {file1} {file2} {target} may be used. /rf Use 2 seconds file time resolution in local time. For FAT16, FAT32, exFAT, ISO 9660 (CDFS), UDF and others. File times are considered equal if the file time difference is less than or equal to 2 seconds ± 1 hour daylight saving. This is the default. /ru Use 1 second file time resolution in UTC (GMT). For Unix file systems and others, e.g. Network Attached Storage (NAS). File times are considered equal if the file time difference is less than 1 second. /rn High precision 100 ns NTFS file time resolution in UTC (GMT). For NTFS partitions in Windows systems. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc newest" will display or copy the newest of two files. Security attributes (ACL) and alternate data streams (ADS) are not copied. Example of usage in a script/batch (line breaks inserted for readability): @echo off setlocal enableextensions if not cmdextversion 2 (echo CMD extensions 2 not available!&exit /b 255) set NX0=%~nx0 adc cmdverify 1 /dC:\SYS /dS:\SYS /m"%APPDATA%\ADC" if not %errorlevel%==143 (echo ADC.EXE is not available or invalid environment!&exit /b 255) if "%~1"=="BatchCall" goto BatchCall adc newest "C:\SYS\ADC.exe" "S:\SYS\ADC.exe" "%APPDATA%\ADC\ADC.exe" "C:\SYS\ADC.exe.config" "S:\SYS\ADC.exe.config" "%APPDATA%\ADC\ADC .exe.config" "C:\SYS\%NX0%" "S:\SYS\%NX0%" "%APPDATA%\ADC\%NX0%" /rn if not %errorlevel%==0 exit /b 255 cd /D "%APPDATA%\ADC" "%NX0%" BatchCall exit /b 255 :BatchCall ... ------------------------------------------------------------------------------- adc numberlist {start} [{count}] [/h] [/u] start Start number, may include non-digit characters. Characters in {start} that are not valid digits, will be kept as is, including hexadecimal A - F of the not used upper/lower case. count Count of numbers to generate, default 100 or 256 if /h. /h Use hexadecimal numbers. /u Use upper case characters (A - F) in hexadecimal numbers. Default is lower case characters (a - f). Generates list of numbers, incremented by one, examples of usage: numberlist 00100 numberlist /h /u 00-20-3C-00-12-00 1024>mac.txt numberlist /h AbC 2 (will output "AbC" and "AcC") numberlist /h /u AbC 2 (will output "AbC" and "AbD") ------------------------------------------------------------------------------- adc ping {host} {num} [/t{text}] [/l{log}] [/o{code}] [/z{zone}] [/a] host Host IP address or name. num Optional number of pings to do, or 0 for infinite loop. Default is 4. text Format leading text with special $ character sequences, see below. Default is /t"$l: ". Use the escape sequence #HHHH for Unicode characters whose code is hexadecimal HHHH. Escape sequences #HHHH are processed first. /l Write log to file {log}, default is to output to the screen only. /o Output character encoding of the log file. Default is the current code page (CHCP). /z Use the time zone specified as hours from UTC, default is the local time of the system. /a Append to the log file, keeping any existing BOM and encoding. Default is to overwrite if file exist, ignoring any existing BOM. Special $ character sequences in {text}: $n Loop count with no leading or trailing spaces. $l Loop count, left-aligned with leading spaces. $z Loop count, left-aligned with leading zeros. $! Newline $$ Dollar sign $ Useful #HHHH escape sequences in {text}: #0009 Tab character #0022 Quotation mark " #0023 Number sign # #0025 Percent sign % #0026 Ampersand & #002F Forward slash / #003C Less-than sign < #003E Greater-than sign > #005E Caret ^ ## Number sign # {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is the current code page (CHCP). Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc ping" uses the standard Ping (ICMP Echo Request). If at least one ping succeeds then ERRORLEVEL is set to 0 else ERRORLEVEL is set to 1. Press the ESC key to terminate "adc ping". Example of usage: adc ping 192.168.1.10 adc ping 192.168.1.10 1 /t"Ping " ------------------------------------------------------------------------------- adc poi {dst} {src} ... [/a{area}] [/o] [/q] dst Destination output POI file, formats: OV2, TXT src Source input POI file(s), formats: KML, GPX, OV2 Wildcards are valid. Hidden and/or system files are ignored. ... Many source files separated with spaces may be used. /a Number of POI per area, 4 - 4096, default is 32. /o Order (sort) POIs, using ordinal Unicode. /q Quiet mode, will not display POIs. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. Converts a Point Of Interest (POI) file to another file with another format. The formats are specified by the file extensions of {src} and {dst}. The output OV2 file is optimized with "skipper records", i.e. the POIs are split into areas of maximum {area} number of POI. The command "adc poi out.ov2 in.ov2" may be used as an OV2 optimizer. The POI names in OV2 uses Windows ANSI code page 1252 (ISO-8859-1). Examples of usage: adc poi tomtom.ov2 google.kml adc poi optimized.ov2 original.ov2 /a64 adc poi favorites.ov2 standard.kml holiday2014.kml /a4096 /o ------------------------------------------------------------------------------- adc pwdgen [mask] [num] [/c] [/d] mask Either a number or a character string. If a number then the length of the default password format. If a string then type of characters to generate: a Alphanumeric: 0-9, a-z d Digit: 0-9 h Hexadecimal digit: 0-F l Letter: a-z v Vocal: a e i o u y c Consonant: b c d f g h j k l m n p q r s t v w x z * All in lower and upper case, except symbols # All with usable symbols (punctuations) num Number of passwords to generate, default 10. /c No consecutive duplicates. /d No duplicates at all. Generates passwords. Examples of usage: adc pwdgen 12 adc pwdgen cvccvc adc pwdgen hhhhhhhhhh 8 adc pwdgen laaaaaaaaaaa /c adc pwdgen ************ /d ------------------------------------------------------------------------------- adc qsort {path} ... [/l] [/c{cult}] [/i{code}] [/o{code}] [/n] [/u] [/s] [/q] [/v] path Pathname to files, wildcards are valid. Hidden and/or system files are ignored. ... Many pathnames separated with spaces is allowed. /l Case insensitive sort, ignoring upper/lower letters. /c Use the culture {cult} for sorting, see "adc culture". Default is to use ordinal character codes. /i Default input character encoding to use when there is no existing BOM in a file. Default is the current system Windows ANSI code page. /o Forced output character encoding to always use. Default is to keep a files encoding as is. /n Do not add a Byte Order Mark (BOM) to the files. /u Write Unix newlines instead of Windows newlines. /s Sort found files in sub-directories also. /q Quiet mode, will not display files. /v Verbose mode, will also display number of lines and execution time. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is current code page (CHCP). "adc qsort" does not do heuristic encoding detection, it only checks for any Byte Order Mark (BOM) in the beginning of the files. Examples: adc qsort data.txt /cen-US ------------------------------------------------------------------------------- adc rencase {path} ... [/s] [/l|/u] [/d|/b] [/c{cult}] [/x] path Pathname to a directory or a file, wildcards are valid. ... Many pathnames separated with spaces is allowed. /s Search in subdirectories also. /l Rename file names to lower case. /u Rename file names to upper case. /d Rename only directories. By default only files are renamed. /b Rename both files and directories. /c Use the culture {cult} for upper/lower characters, see "adc culture". If /c alone (no {cult}) then the current user default culture is used. Without option /c the invariant culture is used. /x Execute rename. Without option /x, the files and directories are only displayed and not renamed. Only when /x is used will they be renamed. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. ------------------------------------------------------------------------------- adc search {path} {srch} [/i{code}] [/l] [/c{cult}] [/r] [/s] [/v] [/q] [{rplc}] [/o{code}] [/n] [/u] [/x] path Pathname to files, wildcards are valid. Hidden and/or system files are ignored. srch Text to search, use " if spaces. Use the escape sequence #HHHH for Unicode characters whose code is hexadecimal HHHH. /i Default input character encoding to use when there is no existing BOM in a file. Default is the current system Windows ANSI code page. /l Case insensitive search, ignoring upper/lower letters. /c Use the culture {cult} for upper/lower letters, see "adc culture". If /c alone (no {cult}) then the current user default culture is used. Without option /c the invariant culture is used. /r Use C# regular expression, see: http://msdn.microsoft.com/en-us/library/az24scfc(v=vs.90) Escape sequences #HHHH are processed before the C# regular expression. /s Search found files in sub-directories also. /v Verbose output, will display all found lines. /q Quiet mode, will not display anything. rplc Optional. When used, all found {srch} sequences will be replaced with {rplc}, and written to the files if /x is used. Use the escape sequence #HHHH for Unicode characters whose code is hexadecimal HHHH. The options below are only used when replacing: /o Forced output character encoding to always use. Default is to keep a files encoding as is. /n Do not add a Byte Order Mark (BOM) to the files. /u Write Unix newlines instead of Windows newlines. /x Execute replaces. Without option /x, the replaces are only displayed but no files are modified. Only when /x is used files will be modified. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is current code page (CHCP). Sets ERRORLEVEL to: 0 No found lines. 1 One line found. 2 Two lines found. . . 253 253 lines found. 254 254 or more lines found. 255 Generic error. "adc search" does not do heuristic encoding detection, it only checks for any Byte Order Mark (BOM) in the beginning of the files. The search (and replace) is done within single lines, accepting Windows, Unix, Mac Classic or inconsistent newlines characters. The Unicode characters #000A and #000D will never be found if used in the search string. Without the options /v and /q, then only found file names are displayed, useful for script/batch processing. Useful escape sequences: #0009 Tab character #0022 Quotation mark " #0023 Number sign # #0025 Percent sign % #0026 Ampersand & #002F Forward slash / #003C Less-than sign < #003E Greater-than sign > #005E Caret ^ ## Number sign # Examples: adc search *.txt /s my@email.com adc search data.tab #0009 , adc search *.txt /s /r "old(\w*)@email.com" "new$1@email.com" /x ------------------------------------------------------------------------------- adc sleep {ms} [{loop}] [{file}] [{except} ...] [/u] ms Milliseconds to sleep (in each loop). loop Optional loop count while file exists and user has not pressed [ESC]. file Optional file to check, wildcards are valid, terminates with ERRORLEVEL 1 when no files or directories exists. except Optional name string exception. If a found file name is equal to the exception string, the file is ignored as if it does not exist. ... Many exceptions may be used. /u Enable user [ESC] key, terminates with ERRORLEVEL 2 if user press the [ESC] key. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. The check for file existence and/or [ESC] key is only done once in each loop. When time is up, file exist and no user [ESC] key, ERRORLEVEL is set to 0. Example of usage in a script/batch: echo Will wait up to 1 hour. Press the [ESC] key to terminate. adc sleep 100 36000 D:\Script\*.bsy server.bsy /u See also "adc waitfile". ------------------------------------------------------------------------------- adc sound {sound} [{silent}] [{loop}] [/u] sound Path to a WAV file to play, or if the first character is * then play the WAV file defined in the registry at: HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\{sound}\.Current Typical registry entries are: CriticalBatteryAlarm, DeviceConnect, DeviceDisconnect, DeviceFail, LowBatteryAlarm, MailBeep, SystemAsterisk, SystemExclamation, SystemExit, SystemHand, SystemNotification, SystemQuestion, SystemStart, WindowsLogoff, WindowsLogon. Use a single "*" to get a list of all registry entries for the current user. silent Milliseconds to wait while silent after the sound has been played. loop Loop count to repeat {sound} and {silent}. /u Enable user [ESC] key, terminates with ERRORLEVEL 2 if user press the [ESC] key. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc sound" plays a sound from a WAV file or a Windows system sound. Examples: adc sound * adc sound *SystemAsterisk 1000 adc sound MySound.wav 2000 10 /u ------------------------------------------------------------------------------- adc stopwatch {mode} {file} {sec} [/q] mode Mode, one of: start Start stopwatch, will create and write to the {file}. stop Stop stopwatch, will get the time of the {file} and then delete it. Compare with {sec}. time Get the time of the {file} and compare with {sec}. May be used on any file to compare the time since the file was written to. file File to use by the stopwatch. sec Compare time. If more seconds has gone since {file} was created or written to, ERRORLEVEL will be set to 1. {sec} may only be used with 'stop' and 'time'. /q Quiet mode. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc stopwatch" will measure the time between start and time/stop, useful for performance measure in script/batch. Example of usage in a script/batch: @echo off adc stopwatch start C:\Stopwatch adc compdir D:\Data D:\Backup /h /c adc stopwatch stop C:\Stopwatch ------------------------------------------------------------------------------- adc terminal {remote} [{file}] [/x] [/e] [/m] [/i{code}] [/o{code}] [/n] [/a] [/t] [/z{zone}] remote Remote port or address with optional parameters, se below. Or use * to get a list of all registred COM-ports from "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", all other arguments and options are ignored. file Output text (log) file, default is to output to the screen only. /x If {remote} is a serial port then use an alternative serial communication method, different than and independent of .NET Framework. /e Echo by remote, default is local echo. /m Multiple sessions, "adc terminal" does not exit after a port is closed. /i Input/Output character encoding of the remote. Default is the current system Windows ANSI code page. /o Output character encoding of the output file. Default is the same encoding as /i. /n Do not add a Byte Order Mark (BOM) to the output file. /a Append to the output file, keeping any existing BOM and encoding. Default is to overwrite if file exist, ignoring any existing BOM. /t Start all lines with date and time in ISO 8601 format. /z Use the time zone specified as hours from UTC, default is the local time of the system. If {remote} is a serial port then: {port}[,{baud}[,{data}[,{par}[,{stop}[,{cts}[,{dsr}]]]]]] port Serial port: COM1 to COM999999999. With optional ':' after. baud Baud rate: 50-4000000. Default 115200 bps. data Data bits: 7 or 8. Default 8 data bits. par Parity: N, O, E, M or S. Default no parity (N). stop Stop bits: 1 or 2. Default 1 stop bit. cts CTS/RTS handshake: N or C. Default no CTS/RTS handshake (N). dsr DSR/DTR handshake: N or D. Default no DSR/DTR handshake (N). DSR/DTR handshake is only available with option /x. If {remote} is an Internet Host or IP address then: {host}[,{port}] host Host name or IP address of remote. Use SERVER to start a TCP server that will answere to clients on all network interfaces, supporting both IPv4 and IPv6. port TCP port number to use, default is 23 (Telnet). {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is the current code page (CHCP). Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc terminal" transmits and receives characters via a serial port or TCP/IP. Examples: adc terminal * adc terminal COM1,115200,8,N,1,N,N /x adc terminal 192.168.47.8,23 /e adc terminal digsys.se,80 adc terminal server,23 /m adc terminal ::ffff:c000:280,80 /m ------------------------------------------------------------------------------- adc test {no} no Any number to set ERRORLEVEL to. Typical usage in a script/batch to verify that ADC is installed and available: @echo off setlocal enableextensions if not cmdextversion 2 (echo CMD extensions 2 not available!&exit /b 255) adc test 143 if not %errorlevel%==143 (echo ADC.EXE is not available!&exit /b 255) ... See also "adc cmdverify". ------------------------------------------------------------------------------- adc textmake {src} {dst} {first} {begin} {val} {sep} {end} {last} [/p{proc}] [/l{num}] [/m] [/i{code}] [/o{code}] [/n] [/u] src Source input file. dst Destination output text file (usually ASM, C, C++, C#, Perl, HTML). If {dst} is "CON", the output goes to the console and the options /m, /o, /n and /u are ignored. first Output text of first line before first value. begin Output text at the beginning of internal lines with values. val Output text to use on each value. sep Output text to use between (separate) each value. end Output text at the end of internal lines with values. last Output text of last line after last value. /p Process the input {src} file using method {proc}, see below. /l Number of values per line, separated by a comma. Default is 16. /m If {dst} exist then write in memory and compare with {dst} if it needs to be updated. When option /m is used, the {dst} file will only be written to (and get its date and time updated) if there are any changes in the file. /i Default input character encoding to use when there is no existing BOM in {src} or {dst}. Default is the current system Windows ANSI code page. Used for {dst} when option /m is used, or on {src} when option /pLINES is used ({src} is a text file). /o Forced output character encoding of {dst}. If option /m is used then the default is to keep the encoding as is or as option /i. Else if option /pLINES is used then the default is the use the same encoding as {src}. Else the default is the current system Windows ANSI code page. /n Do not add a Byte Order Mark (BOM) to {dst}. /u Write Unix newlines instead of Windows newlines. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. {proc} is one of: <bytes> Generic binary file, <bytes> is a number 1 to 8 specifying the number of bytes per value. E.g. /p1 will get bytes (8-bits) and /p4 will get DWORDs (32-bits). The first value is at file location 0. /p1 is the default if option /p is not used. BMP8 Image file to BMP. The source input file should be an image file of type BMP, GIF, JPG, PNG or TIFF. The image will be converted to a Windows bitmap byte array. Each byte is then outputed as a value in the output text {val}. The first byte values are at the upper/left corner, and each scan line is aligned (padded) to 8 bits. BMP16 Same as BMP8 but with 16 bit alignment. BMP32 Same as BMP8 but with 32 bit alignment. BMP64 Same as BMP8 but with 64 bit alignment. LINES Each value in the output text {val} is a text line from {src}. End of line sequences are removed. It accepts Windows, Unix, Mac Classic or inconsistent newlines characters. {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is current code page (CHCP). "adc textmake" converts a binary file to text files. The output texts {first}, {begin}, {val}, {sep}, {end} and {last} are outputted (written) in the following manner (line breaks inserted for readability): {first} {val} {sep} {val} {sep} ... {val} {sep} {val} {end} {begin} {val} {sep} {val} {sep} ... {val} {sep} {val} {end} ... {begin} {val} {sep} {val} {sep} ... {val} {sep} {val} {end} {begin} {val} {sep} {val} {sep} ... {val} {sep} {val} {last} The output texts are strings with C# composite format items, syntax "{index[,align][:format]}", see: http://msdn.microsoft.com/en-us/library/txafckwd C# composite format items as examples: {0} Translates to the newline sequence {1} Translates to the character: % {2} Translates to the character: $ {3} Translates to the character: " {4} Translates to the character: > {5} Translates to the character: < {6} Translates to the character: | {7} Translates to the character: ^ {8} Translates to the character: { {9} Translates to the character: } {10} Translates to command line used {11:X2} Value in two uppercase hexadecimal digits {12:X4} Line offset in four uppercase hexadecimal digits {13:D} Number of values (in decimal digits) {14:D} Image width {15:D} Image height {16:D} Image bits per pixel Note, normally "{0}" is used in the output texts {end} and {last}, otherwise no line breaks will be outputted. Example of usage (line breaks inserted for readability): adc textmake data.bin data.asm /l8 "Data_Bytes EQU {2}{0} DB " " DB " "0x{11:X2}" "," " ;0x{12:X4}{0}" " ;0x{12:X4}{0}Data_Size EQU {13:D}{0}" Result in file "data.asm" (not all lines shown): Data_Bytes EQU $ DB 0xE6,0xF0,0x60,0xFA,0x9A,0xB7,0xFE,0x70 ;0x0000 DB 0xA4,0x00,0xB2,0xFE,0x7E,0xB7,0x86,0xF0 ;0x0008 ... (lines skipped) DB 0xFF,0x00,0x87,0x78,0x87,0x87,0xCC,0x00 ;0x0488 DB 0x00,0x00,0x00,0x00,0x25 ;0x0490 Data_Size EQU 1173 Example of usage (line breaks inserted for readability): adc textmake image.bmp image.c /l12 /pBMP8 "#define Width {14:D}{0} #define Height {15:D}{0} #define BPP {16:D}{0} unsigned char Bytes[{13:D}]={8}{0}" "" "0x{11:X2}" "," ",{0}" "{9};{0}" Result in file "image.c" (not all lines shown): #define Width 151 #define Height 26 #define BPP 1 unsigned char Bytes[494]={ 0x7F,0xE1,0xFF,0xF3,0xFF,0x9F,0xFC,0xE0,0x07,0xFF,0xC0,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF1,0xFF,0xF3,0xFF, ... (lines skipped) 0x38,0x0E,0x01,0xC3,0xFF,0x07,0x0F,0x0E,0x3F,0xFE,0x70,0x1F, 0x01,0xC0}; Example of usage (line breaks inserted for readability): adc textmake lines.txt lines.cs /pLINES /l5 "new String[{13:D}] {8}{0}" "" "{3}{11}{3}" ", " ",{0}" "{9};{0}" Result in file "lines.cs": new String[10] { "Line 1", "Line 2", "Line 3", "Line 4", "Line 5", "Line 6", "Line 7", "Line 8", "Line 9", "Line 10"}; ------------------------------------------------------------------------------- adc textproc {src} {dst} {name}={value} ... [/c{chr}] [/e{esc}] [/m] [/i{code}] [/o{code}] [/n] [/u] src Source input text file. dst Destination output text file. If {dst} is "CON", the output goes to the console and the options /m, /o, /n and /u are ignored. name Variable define, defines 'name' to 'value'. value Value for the variable 'name'. ... Many defines may be used. /c Token character. Use a single character, or a Unicode number. Default is /c# or /c35. Use for example /c` or /c96 when # cannot be used, as in C/C++/C#/Perl source code files. It cannot be a name character. /e Additional characters that will be escaped by "#name\#" and "#strinc", default is only the characters: ' " \ This is good for C/C++/C#. For Perl use: /e$@ /m If {dst} exist then write in memory and compare with {dst} if it needs to be updated. When option /m is used, the {dst} file will only be written to (and get its date and time updated) if there are any changes in the file. /i Default input character encoding to use when there is no existing BOM in {src}. Default is the current system Windows ANSI code page. /o Forced output character encoding of {dst}. If option /m is used then the default is to keep the encoding as is. If not option /m or if no BOM in {dst} then the default is to use the same encoding as {src} or option /i. /n Do not add a Byte Order Mark (BOM) to {dst}. /u Write Unix newlines instead of Windows newlines to {dst}. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is current code page (CHCP). "adc textproc" process text files with conditions and variables, similar to that the C/C++ preprocessor does. It accepts Windows, Unix, Mac Classic or inconsistent newlines characters. Line directives (the line is removed in the destination file): #define name value Set 'name' to 'value', use " or # if spaces. #undef name Undefine 'name'. #ifdef name Process following lines only if 'name' is defined. #else Else statement for conditional processing. #endif End of conditional processing. #ifndef name Process lines only if 'name' is not defined. #include "file" Include file and read Line directives only. Good for C/C++ header files. #textinc "file" Include file and process Line and Text directives. #strinc "file" expr Include file and process Line and Text directives, and make C/C++/C#/Perl strings with escape sequences. All #strinc# in 'expr' will be replaced by a line from the file. 'expr' will be processed for all lines. Text directives (the token is replaced in the destination file): #name# Replace #name# with the value of 'name'. #name\# Replace to value of 'name' using escape sequences. #c Escapes any character c except name characters. Using e.g. "#\" will result in "\" even if it is done in a file to "#strinc", that normally would escape "\" to "\\". Example of usage: adc textproc perl.pls perl.pl /c96 /e$@ ------------------------------------------------------------------------------- adc touch {path} ... [/f{file}] [/d[YYYY-MM-DD]] [/t[HHMM]] [/s] path Pathname to files, wildcards are valid. Hidden and/or system files are ignored. ... Many pathnames separated with spaces is allowed. /f File to get date & time from, instead of the current system date & time. /d Date to use, in ISO 8601 format YYYY-MM-DD. Time is set to 12:00:00.0000000 UTC±00:00. If only /d without YYYY-MM-DD then the date is kept as is. /t Hours and minutes to use, seconds and parts of seconds are cleared. If only /t without HHMM then hours and minutes are kept as is. /s Touch found files in sub-directories also. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. "adc touch" sets the create, last-access and last-write dates and times of the specified files. By default it will use the current system date and time. ------------------------------------------------------------------------------- adc trim {path} ... [/i{code}] [/o{code}] [/n] [/u] [/t] [/s] path Pathname to files, wildcards are valid. Hidden and/or system files are ignored. ... Many pathnames separated with spaces is allowed. /i Default input character encoding to use when there is no existing BOM in a file. Default is the current system Windows ANSI code page. /o Forced output character encoding to always use. Default is to keep a files encoding as is. /n Do not add a Byte Order Mark (BOM) to the files. /u Write Unix newlines instead of Windows newlines. /t Filter tabs to spaces also. /s Trim found files in sub-directories also. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. {code} is one of: ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF8 UTF-8. UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is current code page (CHCP). "adc trim" does not do heuristic encoding detection, it only checks for any Byte Order Mark (BOM) in the beginning of the files. By default, "adc trim" will for each found file, read all lines, accepting Windows, Unix, Mac Classic or inconsistent newlines characters, filter control and whitespace characters to ordinary spaces, remove trailing whitespaces and then write all lines using Windows or Unix newlines to the same file. The only outputted whitespace and control characters are the newlines, spaces and tabs. Examples: adc trim *.txt /s adc trim /s /t /iUTF8 /oUTF8 *.ashx *.aspx *.cs *.master *.config adc trim /s /t /iUTF8 /oUTF8 /n *.css *.js *.htm *.html adc trim /s /t /oOEM robots.txt *.cmd *.bat ------------------------------------------------------------------------------- adc txtcode {src} [{dst}] [/i{code}] [/o{code}] [/n] [/c] src Source text file. dst Destination text file. If {dst} is not used, BOM information about {src} will be displayed. /i Input character encoding of the source file. A warning will be displayed if there is a mismatch in an existing BOM. /iAUTO will use the current system Windows ANSI code page if no BOM exists. /o Output character encoding of the destination file. Default is UTF8. /oAUTO is the same as /oANSI (current system Windows ANSI code page). /n Do not add a Byte Order Mark (BOM) to the destination file. /c Display all code pages in the system and ignore all other options. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. {code} is one of: AUTO Detect by BOM or use ANSI code page (default for input source). ANSI Current system Windows ANSI code page. OEM Current system OEM code page. UTF7 UTF-7 (BOM not supported). UTF8 UTF-8 (default for output destination). UTF16LE UTF-16 Little Endian (Windows). UTF16BE UTF-16 Big Endian (Unix). UTF32LE UTF-32 Little Endian (Windows). UTF32BE UTF-32 Big Endian (Unix). <cp> Code page number <cp>. 0 is the current code page (CHCP). "adc txtcode" does not do heuristic encoding detection, it only checks for any Byte Order Mark (BOM) in the beginning of the input file. Examples: adc txtcode checkme.txt adc txtcode ansi.txt oem.txt /oOEM adc txtcode /c ------------------------------------------------------------------------------- adc udpping {host} {port} {num} host Host IP address or name. Use SERVER to start a UDP Ping server that will answere to clients on all network interfaces, supporting both IPv4 and IPv6. port UDP port number. num Optional number of pings to do, or 0 for infinite loop. Default is 4. Press the ESC key to terminate UdpPing. "adc udpping" is similar to the standard Ping (ICMP Echo Request), but uses only UDP. The host must be aware of this non-standard usage of UDP. "adc udpping" sends an UDP with four bytes of data (a 32-bit integer loop counter). The host replies with the same data. Example of usage: adc udpping 192.168.1.10 16050 adc udpping server 16050 adc udpping digsys.se 14300 16 adc udpping ::ffff:c000:280 0x10F0 0 ------------------------------------------------------------------------------- adc validarg {level} {length} ... level Level of validation of the arguments on the command line. length Length limit 1-32767, maximum length of each argument, e.g. 300. ... Any number of arguments. The standard adc command line interpretation is used, e.i. " is used to include spaces. {level} is one of: 0 All characters are valid except: ctrls " < > | 1 As 0, plus the invalid chars: spaces & ^ 2 As 1, plus the invalid chars: ( ) ; , ' ` 3 As 2, plus the invalid chars: [ ] { } @ = ! + ~ Example of usage in a batch/script: @echo off adc validarg 3 300 %* if not %errorlevel%==0 goto error ... ------------------------------------------------------------------------------- adc waitfile {ms} {loop} {file} [{except} ...] [/u] ms Milliseconds to sleep (in each loop). loop Loop count while file not exists and user has not pressed [ESC]. file File to check, wildcards are valid, terminates with ERRORLEVEL 0 when files or directories exists. except Optional name string exception. If a found file name is equal to the exception string, the file is ignored as if it does not exist. ... Many exceptions may be used. /u Enable user [ESC] key, terminates with ERRORLEVEL 2 if user press the [ESC] key. Use "\\?\D:\Path" or "\\?\UNC\Server\Share\Path" for long paths. The check for file existence and/or [ESC] key is only done once in each loop. When time is up, no file exist and no user [ESC] key, ERRORLEVEL is set to 1. Example of usage in a script/batch: echo Will wait up to 1 hour. Press the [ESC] key to terminate. adc waitfile 100 36000 D:\Reply.txt /u See also "adc sleep". -------------------------------------------------------------------------------

Version

Version history of ADC Version: Date (ISO): Comments: 1.0.0.14 2012-11-22 First public release. 1.0.0.15 2012-11-30 The Win32 'CopyFile()' function is no longer used, due to Windows 8 and Windows Server 2012 now also copies the security attributes (ACL). Clarified the help about security attributes (ACL) of the commmands: "adc cond", "adc mirror" and "adc newest". 1.0.0.16 2012-12-03 Bugfix of files larger than 2 GB. 1.0.0.17 2012-12-09 Added "adc cmdverify". Improved "adc newest". 2012-12-10 Remove files by number of days in "adc delexcess". 2012-12-12 Options /rf, /ru and /rn added to the commands "adc compdir", "adc mirror" and "adc newest" to support FAT, UNIX and NTFS file time resolutions. 2012-12-13 Added "adc sound". 2012-12-22 Improved internal 'CopyFile()' function to use asynchronous file I/O. Added options /nc and /a to the command "adc mirror". 1.0.0.18 2013-01-08 "adc mirror" will now overwrite read-only files. 1.0.0.19 2013-01-20 Bugfix of " and \ usage in "adc get". 2013-02-12 Removed option /nc from the command "adc mirror". 2013-02-13 Added option /ne to the command "adc mirror". 1.0.0.20 2013-03-16 "adc search" now uses escape sequences #HHHH. 2013-03-18 "adc stopwatch" will now use Last Write Time as intended and not Last Access Time. 1.0.0.21 2013-03-21 Added option /m to the command "adc terminal". 2013-03-25 The internal 'CopyFile()' will now try to delete the destination (target) file on file copy errors. Added Ctrl+A as abort after ESC is pressed during file copy in "adc mirror". Timeout of asynchronous file I/O increased from 20 seconds to 1 hour (for large files over slow VPN). 2013-03-30 New command "adc poiconv". 2013-04-28 Minor fixes. 1.0.0.22 2013-06-02 Added option /q to "adc search". 2013-07-22 Bugfix of internal exception when BOM was written in "adc textmake" and "adc textproc". 1.0.0.23 2013-07-25 Added argument {time} to the command "adc errexist". 2013-10-01 Added option /v to "adc search", changed option /q, displayed output and ERRORLEVEL. 1.0.0.24 2013-11-01 New command "adc hexview". 2013-11-10 Improved "adc hex" option "d#={dynamic}". 2013-11-18 Prevents idle timeouts during executions. 2013-11-21 Added option /d to "adc touch". 1.0.0.25 2014-01-13 Recompile with Visual Studio 2013 and Windows 8.1. 2014-01-19 Added option /x to "adc terminal". 2014-02-10 Bugfix of "access denied" when file or device permission was not "full control". 1.0.0.26 2014-02-21 Added format "H0" and #HHHH escape sequences to "adc datetime". 2014-02-27 New syntax and improved "adc dr". 1.0.0.27 2014-06-04 Renamed "adc poiconv" to "adc poi". New syntax and improved "adc poi". 2014-06-11 Changed the argument {time} to an option and added the argument {except} to the command "adc errexist". 1.0.0.28 2014-12-04 Improved internal file handling. 2015-03-17 Increased "adc ftpsend" timeouts. 1.0.0.29 2015-03-24 Added option /t to "adc ping". 2015-04-04 Added TXT output of "adc poi". 2015-05-22 Improved internal file handling. Added "ProgramW6432" to "adc cmdverify". 2015-07-01 "adc mirror" verifies that at least one file/directory exists in the master path. 1.0.0.30 2015-07-29 Added log options to "adc ping". 2015-08-09 New command "adc copydir". 2015-08-14 New command "adc waitfile". 2015-08-16 Added option /m to "adc cmdqueue". 2015-08-19 New command "adc between". 1.0.0.31 2015-10-22 Added option /o to "adc log". 2015-12-10 Updated "ADC.ReadMe.txt" about .NET Framework 4.5.2, 4.6 and 4.6.1. 1.0.0.32 2016-04-09 Added option /e to "adc log". 1.0.0.33 2016-06-30 Added option /h to "adc copydir". 2016-07-07 Handle files larger than 1.5 GB in "adc bom" and in "adc search" when not replacing. 2016-07-15 Bugfix of "adc frm E" when using a destination path. 1.0.0.34 2017-03-17 Internal changes and improvements. 1.0.0.35 2017-05-17 "adc cmdverify" now uses option /o for "APPDATA". 1.0.0.36 2017-05-23 Added option /e to "adc daynumber". 2017-06-11 Removed file size limit in "adc ftpsend". 1.0.0.37 2017-08-11 Added the Adler-32 checksum and execution time measurements in "adc crc". 2017-08-31 Improved internal file handling.
Copyright © 1996-2017 Scandinavian Digital Systems AB
Developed by Anders Danielsson