DOS Doctor - 140 Batch Subroutines Ready to Use

Supported by:

WinSize2 at SourceForge.net
DOS Doctor

DOS Doctor

more than 140 Batch Subroutines Ready to Use


Actual version:
1.23 / 2011-05-03


1.22 / 2010-09-14

1.21 / 2010-07-06


Download DOS Doctor

Other Programs by the same Author

Disclaimer



All subs are written in pure Windows DOS Batch command language.

Modular built DOS Batch Subroutines supporting Date and Time handling inclusive error handling, command execution with automatic "Delayed Expansion", subroutines for disk partitions, language detection, string handling and last but not least "debugging" of complex DOS projects ... and a detailed handbook (today 200 pages - don't be afraid you do not have to read all of them).

And if you want to see a "small" example using these routines you should have a look at "Timer - Die Zeitschaltuhr" (Other Programs by the same Author) which is written of nearly 10.000 lines of DOS code. About half of the lines of code are the routines of this compilation.

Content:

  • GetDateTime with arguments date / time / actual
  • Date/ Time output formats: %Year%, %Month%, ..., %Sec%, %YYMMDD% %HHMMSS% ...
  • Adding / subtracting days to a date incl. leap years
  • Restarting a batch with "!Delayed Expansion!"-variables if necessary
  • Routines to act apon "%UserVariables%"
  • Routines for checking disk space and automatic alarm to an admin PC
  • Handing characters / strings (replace/ fill/ upper/ lower/ centered)
  • Searching for USB sticks
  • Simplified / automatic NetSend, NetUse
  • Automated backup utilities (full and part backups) using 7-ZIP or equivalent
  • Automated backup utilities for Acronis Backup (special)
  • Possibility to load all necessary subs into one file with automatic internal call of the subs (DOS project)
  • Debugging a DOS project file (echo to file / trace info on screen)
  • Measurement of time consumption (mean value) for individual subs (running in the project context)
  • Generation of a "Make File" creating a DOS project file (gathering all subs till end of sub-tree) -- written in DOS batch!
  • (Detailed info about routines: see below)


Output of GetDateTime
Backup a file with GetDateTime and the output parameters set by the routine


The Routines in Detail:

Chapter Name of Sub Description Page
4.1 Initialising: using Call_Init and Call_Exit 34
4.1.1 Examples 34
4.1.2 Startparameters 36
4.1.3 User-defined Parameters 38
4.2 Call_Check 39
4.3 Call_Debug do not use 39
4.4 Call_Help used in the header for interactive help 39
4.5 Char_Fill_LE insert on the left side of the string 40
4.6 Char_Lower to lower case 40
4.7 Char_Upper to upper case 41
4.8 Char_Remove remove chars from string 41
4.9 Char_Remove_LE remove chars from string – left side 42
4.10 Char_Replace replace chars with other chars 43
4.11 Char_Replace_AnyChar with char(s) 44
4.12 Chk_Date return YY, MM, DD in correct format 44
4.13 Chk_DaySec corrects No. of Days / Seconds 46
4.14 Chk_DevChar_Free return next free device character 46
4.15 Chk_DiskFree chk for enough disk space; err-message 47
4.16 Chk_EXE_Exist if executable exists in the path 48
4.17 Chk_File_Exist search for filename in the PATH 49
4.18 Chk_Para checks existence of a parameter 50
4.19 Chk_Time checks for valid entries: HH, MM, SS 51
4.20 CMD_Copy DOS Copy command 52
4.21 CMD_DirFile do for every file in directory 52
4.22 CMD_Ping_SearchList search a computer in all domains 53
4.23 CMD_PressAnyKey Pause command 54
4.24 CMD_Sleep wait x seconds, can be aborted 54
4.25 CMD_Userprofile parse User Profile name 55
4.26 CMD_V_ON restart CMD file with Delayed Expansion 56
4.26.1 What is Delayed Expansion ? 56
4.26.2 Delayed Expansion standard 57
4.26.3 Using CMD_V_ON 57
4.26.4 How does CMD_V_ON work in principle 58
4.27 CMDChkDelayedExpansion Error Msg if D.E. is not enabled 58
4.28 CMDExtensions activated Ext. and D.E. 58
4.29 CMDHide.exe starts program in hidden mode 59
4.30 CMDSetDelayedExpansion to 0 (disable) or 1 (enable) 59
4.31 ColorDef define Colour aliases 60
4.32 Color sets a colour 61
4.33 Dir_Save_Get return String for Global ID / Spec. ID 61
4.34 Dir_Save_Init initializes the name for the global file 63
4.35 Dir_Save_Set sets a string in Global ID / Spec. ID 63
4.36 Dir_Select copies source to destination dir 63
4.37 Dir_Select /COPY copy files from source to selected dir 69
4.38 EchoAct saves Echo On / Off state 72
4.39 EchoLabel conditional Output of a String 73
4.40 ErrorOutput_Template copy file contents to console 73
4.41 File_List list all files in selected drives 74
4.41.1 INI file 75
4.41.2 Selecting drives 75
4.41.3 Selecting directories 75
4.41.4 Example 76
4.42 File_SelectCopy copies a file to Selection dir 76
4.43 File_SelectUpdate updating files from the original dir 78
4.44 GetAllUsersAppData return AllUsers\ Application Data 80
4.44a GetBytesNumber convert By-kB-MB-GB
4.45 GetDateAdd add Days to YY, MM, DD 80
4.46 GetDateDiff return no. of days: Date1 – Date2 81
4.47 GetDateFormat format YY, MM, DD 82
4.48 GetDateTime into Dat_* variables 83
4.49 GetDateTimeAdd add Days / Secs to Date / Time 84
4.50 GetDateTimeFormat check date and time 85
4.51 GetDaysInMonth return number of days in the month 85
4.52 GetEcho return the status of the Echo command (on/off) 86
4.53 GetFilename83 return the filename in 8.3 format 86
4.54 GetFilePartLast splits a path; returns last part 87
4.55 GetIntgAdd add 2 integers with error detection 88
4.56 GetIntgDateToYYYYMMDD convert to YY, MM, DD 89
4.57 GetIntgNumber converts and checks a number 89
4.58 GetIntgTimeToHHMMSS convert to H, M, S 91
4.59 GetIntgThousands put thousand separators into number 91
4.60 GetIntgTrail0 remove trailing zeros 92
4.61 GetLanguage get actual language from registry 92
4.62 GetPartWithPath return Partition containing Path 93
4.63 GetProgID return ID of a loaded program 94
4.64 GetTimeDiff measures time differences 95
4.65 GetTimeHHMMSS0 return act. time as HHMMSSsss 96
4.66 GetTimeLeap / GetTimeLeapJob 97
4.67 GetTokenDate get Date as Integer YYYYMMDD 97
4.68 GetTokenTime get (milli)seconds since midnight 97
4.69 GetUSBStick search for partition containing \_USB-Stick 98
4.70 LAN_Save save network parameters to a file 99
4.71 LAN_Restore restore network parameters from a file 99
4.72 LogFile write date / time / message to file 100
4.73 Map_X maps a share to drive letter X 100
4.73.1 Map_S mapping to S: 101
4.73.2 Fixing the drive letter 101
4.73.3 Fixing the INI file 101
4.73.4 Selecting the computers name 105
4.73.5 Selecting the share 105
4.73.6 Trying the directories from AllTryDir 106
4.74 NetSend_CompName define computer name 106
4.75 NetSend_Error send msg to computer if error occurred 107
4.76 NetUse_IPC connect to a computer (w. user / password) 108
4.77 NetUse_User execute Net Use command for spec. user 109
4.78 NetUse_UserStandard define standard user and password 110
4.79 Parser_Line parses a text into parts 111
4.80 Prog_Name_Wait wait for program to terminate 113
4.81 RegRead read Key\Name from registry 114
4.82 SetDateTime set the Date and Time 115
4.83 ShowError show msg if error occurred 116
4.84 StringAppend chars to a string n times 117
4.85 StringBoxEcho write one line of the box 118
4.86 StringBoxEchoTop write top or bottom of the box 120
4.87 StringCenter centers text in the middle of a line 121
4.88 StringFill fills up a string with chars 121
4.89 StringFillBlank until new length is reached 124
4.90 StringLen returns no. of characters in String 125
4.91 StringMark replaced by StringFill 125
4.92 Var_ClearAll clear all vars beginning with … 125
4.93 Var_GetIndirect returns contents of a content of var 126
4.94 Var_Read reads a file containing var definitions 127
4.95 Var_Write writes var definitions to a file 127
4.95.1 Example 1: Saving and restoring variables 128
4.95.2 Example 2: Replacing one variable 129
4.96 WinVer returns version of Windows operating system 129
.
5 TEST ROUTINES 130
5.1 Call_EchoLevel_Test 130
5.2 SubrCall_ClearAll delete all vars SubrCall… 130
5.3 SubrCall_Result show the result of time measurement 130
.
6 CREATE_MAKEFILE ASSEMBLE ALL FILES 132
6.1 Creating a MakeFile for GetDateTime 132
6.2 Calling Create_MakeFile 133
6.3 Generating the distributable file 134
6.4 How does Create_MakeFile work? 134
6.5 Creating your own subroutines 134
6.5.1 %Call_%Sub 134
6.5.2 Only one %Call_% on a line 135
6.5.3 Use Sub_Template 135
.
7 HOW TO ... 138
7.1 Select your best photos 138
7.2 Updating files to different selected directories 138