Implemented comprehensive DOS 6.22 update system for ~30 test stations with critical fix for test data database import routing. ## Major Changes ### DOS Batch Files (7 files) - NWTOC.BAT: Download updates from network to DOS machines - CTONW.BAT v1.2: Upload with separate ProdSW/LOGS routing (CRITICAL FIX) - UPDATE.BAT: Full system backup to network - STAGE.BAT: System file staging for safe updates - REBOOT.BAT: Apply staged updates on reboot - CHECKUPD.BAT: Check for available updates - DEPLOY.BAT: One-time deployment installer for DOS machines ### CTONW v1.2 Critical Fix Fixed test data routing to match AD2 sync script expectations: - Software distribution: C:\ATE\*.EXE -> T:\TS-4R\ProdSW\ (bidirectional) - Test data logging: C:\ATE\8BDATA\*.DAT -> T:\TS-4R\LOGS\8BLOG\ (upload only) - Subdirectory mapping: 8BDATA->8BLOG, DSCDATA->DSCLOG, HVDATA->HVLOG, etc. - Test data now correctly imported to AD2 database via Sync-FromNAS.ps1 ### Deployment Infrastructure - copy-to-ad2.ps1: Automated deployment to AD2 server - DOS_DEPLOYMENT_GUIDE.md: Complete deployment documentation - DEPLOYMENT_GUIDE.md: Technical workflow documentation - credentials.md: Centralized credentials (AD2, NAS, Gitea) ### Analysis & Documentation (15 files) - CTONW_ANALYSIS.md: Comprehensive compliance analysis - CTONW_V1.2_CHANGELOG.md: Detailed v1.2 changes - NWTOC_ANALYSIS.md: Download workflow analysis - DOS_BATCH_ANALYSIS.md: DOS 6.22 compatibility guide - UPDATE_WORKFLOW.md: Backup system workflow - BEHAVIORAL_RULES_INTEGRATION_SUMMARY.md: C: drive integration ### Session Logs - session-logs/2026-01-19-session.md: Complete session documentation ### Conversation Reorganization - Cleaned up 156 imported conversation files - Organized into sessions-by-date structure - Created metadata index and large files guide ## Technical Details ### AD2 → NAS → DOS Sync Flow 1. Admin copies files to AD2: \192.168.0.6\C$\Shares\test\ 2. Sync-FromNAS.ps1 runs every 15 minutes (AD2 → NAS) 3. DOS machines access via T: drive (\D2TESTNAS\test) 4. NWTOC downloads updates, CTONW uploads test data 5. Sync imports test data to AD2 database ### DOS 6.22 Compatibility - No %COMPUTERNAME%, uses %MACHINE% variable - No IF /I, uses multiple case-specific checks - Proper ERRORLEVEL checking (highest values first) - XCOPY /S for subdirectory support - ASCII markers ([OK], [ERROR], [WARNING]) instead of emojis ### File Locations - AD2: C:\Shares\test\COMMON\ProdSW\ (deployed) - NAS: T:\COMMON\ProdSW\ (synced) - DOS: C:\BAT\ (installed) - Logs: T:\TS-4R\LOGS\8BLOG\ (test data for database import) ## Deployment Status ✅ All 7 batch files deployed to AD2 (both COMMON and _COMMON) ⏳ Pending sync to NAS (within 15 minutes) ⏳ Pending pilot deployment on TS-4R 📋 Ready for rollout to ~30 DOS machines ## Breaking Changes CTONW v1.1 → v1.2: Test data now uploads to LOGS folder instead of ProdSW. Existing machines must download v1.2 via NWTOC for proper database import. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
319 lines
7.4 KiB
Markdown
319 lines
7.4 KiB
Markdown
# DOS 6.22 Boot Sequence and UPDATE.BAT Analysis
|
|
|
|
## Problem Summary
|
|
|
|
User reports:
|
|
1. Manual backup worked: `XCOPY /S C:\*.* T:\TS-4R\BACKUP`
|
|
2. UPDATE.BAT failed to:
|
|
- Detect machine name (TS-4R) when run without parameters
|
|
- Recognize T: drive as available (claims "T: not available")
|
|
|
|
## DOS 6.22 Boot Sequence
|
|
|
|
### Standard DOS 6.22 Boot Process
|
|
|
|
```
|
|
1. BIOS POST
|
|
2. Load DOS kernel (IO.SYS, MSDOS.SYS, COMMAND.COM)
|
|
3. Process CONFIG.SYS
|
|
- Load device drivers
|
|
- Set FILES, BUFFERS, etc.
|
|
4. Process AUTOEXEC.BAT
|
|
- Set PATH, PROMPT, environment variables
|
|
- Start network client (if configured)
|
|
5. User prompt (C:\>)
|
|
```
|
|
|
|
### Network Boot Additions
|
|
|
|
For DOS network clients (Microsoft Network Client 3.0 or Workgroup Add-On):
|
|
|
|
```
|
|
CONFIG.SYS:
|
|
DEVICE=C:\NET\PROTMAN.DOS /I:C:\NET
|
|
DEVICE=C:\NET\NE2000.DOS
|
|
DEVICE=C:\NET\NETBEUI.DOS
|
|
|
|
AUTOEXEC.BAT:
|
|
SET PATH=C:\DOS;C:\NET;C:\
|
|
CALL C:\NET\STARTNET.BAT
|
|
|
|
STARTNET.BAT:
|
|
NET START
|
|
NET USE T: \\D2TESTNAS\test /YES
|
|
NET USE X: \\D2TESTNAS\datasheets /YES
|
|
```
|
|
|
|
### Environment After Boot
|
|
|
|
After STARTNET.BAT completes:
|
|
- **T:** mapped to \\D2TESTNAS\test
|
|
- **X:** mapped to \\D2TESTNAS\datasheets
|
|
- **Environment variables:**
|
|
- COMPUTERNAME may or may not be set (depends on network client version)
|
|
- PATH includes C:\DOS, C:\NET
|
|
- No USERNAME variable in DOS (Windows 95+ feature)
|
|
|
|
## Root Cause Analysis
|
|
|
|
### Issue #1: Machine Name Detection Failure
|
|
|
|
**Problem:** UPDATE.BAT cannot identify machine name (TS-4R)
|
|
|
|
**Likely causes:**
|
|
|
|
1. **COMPUTERNAME variable not set in DOS**
|
|
- DOS 6.22 + MS Network Client 3.0 does NOT set %COMPUTERNAME%
|
|
- This is a Windows 95/NT feature, NOT DOS
|
|
- The batch file is checking for %COMPUTERNAME% which is EMPTY
|
|
|
|
2. **Machine name stored elsewhere:**
|
|
- PROTOCOL.INI (network config file)
|
|
- SYSTEM.INI (Windows 3.x if installed)
|
|
- Could be hardcoded in STARTNET.BAT
|
|
|
|
3. **Detection method flawed:**
|
|
- Cannot rely on environment variables in DOS
|
|
- Must use different approach (config file, network query, or manual parameter)
|
|
|
|
### Issue #2: T: Drive Detection Failure
|
|
|
|
**Problem:** UPDATE.BAT claims "T: not available" when T: IS accessible
|
|
|
|
**Likely causes:**
|
|
|
|
1. **Incorrect drive check method:**
|
|
```bat
|
|
REM WRONG - This doesn't work reliably in DOS 6.22:
|
|
IF EXIST T:\ GOTO DRIVE_OK
|
|
|
|
REM Also wrong - environment variable check:
|
|
IF "%TDRIVE%"=="" ECHO T: not available
|
|
```
|
|
|
|
2. **Correct DOS 6.22 drive check:**
|
|
```bat
|
|
REM Method 1: Check for specific file
|
|
IF EXIST T:\NUL GOTO DRIVE_OK
|
|
|
|
REM Method 2: Try to change to drive
|
|
T: 2>NUL
|
|
IF ERRORLEVEL 1 GOTO NO_T_DRIVE
|
|
|
|
REM Method 3: Check for known directory
|
|
IF EXIST T:\TS-4R\NUL GOTO DRIVE_OK
|
|
```
|
|
|
|
3. **Timing issue:**
|
|
- STARTNET.BAT maps T: drive
|
|
- If UPDATE.BAT runs immediately, network might not be fully ready
|
|
- Need small delay or retry logic
|
|
|
|
### Issue #3: DOS 6.22 Command Limitations
|
|
|
|
**Cannot use in DOS 6.22:**
|
|
- `IF /I` (case-insensitive comparison) - added in Windows NT/2000
|
|
- `%ERRORLEVEL%` variable - must use `IF ERRORLEVEL n` syntax
|
|
- `FOR /F` loops - added in Windows 2000
|
|
- Long filenames - 8.3 only
|
|
- `||` and `&&` operators - cmd.exe features, not COMMAND.COM
|
|
|
|
**Must use:**
|
|
- `IF ERRORLEVEL n` (checks if >= n)
|
|
- Case-sensitive string comparison
|
|
- `GOTO` labels for flow control
|
|
- `CALL` for subroutines
|
|
- Simple FOR loops only (FOR %%F IN (*.TXT) DO ...)
|
|
|
|
## Detection Strategies
|
|
|
|
### Strategy 1: Parse PROTOCOL.INI for ComputerName
|
|
|
|
```bat
|
|
REM Extract computername from C:\NET\PROTOCOL.INI
|
|
REM Line format: computername=TS-4R
|
|
FOR %%F IN (C:\NET\PROTOCOL.INI) DO FIND "computername=" %%F > C:\TEMP\COMP.TMP
|
|
REM Parse the temp file... (complex in pure DOS batch)
|
|
```
|
|
|
|
**Problems:**
|
|
- FIND output includes filename
|
|
- No easy way to extract value in pure batch
|
|
- Requires external tools (SED, AWK, or custom .EXE)
|
|
|
|
### Strategy 2: Require Command-Line Parameter
|
|
|
|
```bat
|
|
REM UPDATE.BAT TS-4R
|
|
IF "%1"=="" GOTO NO_PARAM
|
|
SET MACHINE=%1
|
|
GOTO CHECK_DRIVE
|
|
|
|
:NO_PARAM
|
|
ECHO ERROR: Machine name required
|
|
ECHO Usage: UPDATE machine-name
|
|
ECHO Example: UPDATE TS-4R
|
|
GOTO END
|
|
```
|
|
|
|
**Pros:**
|
|
- Simple, reliable
|
|
- No parsing needed
|
|
- User control
|
|
|
|
**Cons:**
|
|
- Not automatic
|
|
- User must remember machine name
|
|
|
|
### Strategy 3: Hardcode or Use Environment File
|
|
|
|
```bat
|
|
REM In AUTOEXEC.BAT:
|
|
SET MACHINE=TS-4R
|
|
|
|
REM In UPDATE.BAT:
|
|
IF "%MACHINE%"=="" GOTO NO_MACHINE
|
|
```
|
|
|
|
**Pros:**
|
|
- Works automatically
|
|
- Set once per machine
|
|
|
|
**Cons:**
|
|
- Must edit AUTOEXEC.BAT per machine
|
|
- Requires reboot to change
|
|
|
|
### Strategy 4: Use WFWG computername
|
|
|
|
If Windows for Workgroups 3.11 is installed:
|
|
|
|
```bat
|
|
REM Read from SYSTEM.INI [network] section
|
|
REM ComputerName=TS-4R
|
|
```
|
|
|
|
Still requires parsing.
|
|
|
|
### Strategy 5: Check for Marker File
|
|
|
|
```bat
|
|
REM Each machine has C:\MACHINE.ID containing name
|
|
IF EXIST C:\MACHINE.ID FOR %%F IN (C:\MACHINE.ID) DO SET MACHINE=%%F
|
|
```
|
|
|
|
**Pros:**
|
|
- Simple file read
|
|
- Easy to set up
|
|
|
|
**Cons:**
|
|
- Requires creating file on each machine
|
|
- FOR loop reads filename, not contents (wrong approach)
|
|
|
|
## Recommended Solution
|
|
|
|
**Best approach: Use AUTOEXEC.BAT environment variable**
|
|
|
|
This is the standard DOS way to set machine-specific configuration.
|
|
|
|
```bat
|
|
REM In AUTOEXEC.BAT (one-time setup per machine):
|
|
SET MACHINE=TS-4R
|
|
|
|
REM In UPDATE.BAT:
|
|
IF "%MACHINE%"=="" GOTO NO_MACHINE_VAR
|
|
IF "%1"=="" GOTO USE_ENV
|
|
SET MACHINE=%1
|
|
|
|
:USE_ENV
|
|
REM Continue with backup using %MACHINE%
|
|
```
|
|
|
|
This supports both:
|
|
- Automatic detection via environment variable
|
|
- Manual override via command-line parameter
|
|
|
|
## T: Drive Detection Fix
|
|
|
|
**Current (broken) method:**
|
|
```bat
|
|
IF "%T%"=="" ECHO T: not available
|
|
```
|
|
|
|
This checks if environment variable %T% is set, NOT if T: drive exists.
|
|
|
|
**Correct method:**
|
|
```bat
|
|
REM Test if T: drive is accessible
|
|
T: 2>NUL
|
|
IF ERRORLEVEL 1 GOTO NO_T_DRIVE
|
|
|
|
REM Alternative: Check for NUL device
|
|
IF NOT EXIST T:\NUL GOTO NO_T_DRIVE
|
|
|
|
REM We're on T: drive now, go back to C:
|
|
C:
|
|
GOTO T_DRIVE_OK
|
|
|
|
:NO_T_DRIVE
|
|
ECHO [ERROR] T: drive not available
|
|
ECHO Run STARTNET.BAT to map network drives
|
|
GOTO END
|
|
|
|
:T_DRIVE_OK
|
|
REM Continue with backup
|
|
```
|
|
|
|
## Console Output Issues
|
|
|
|
**Problem:** DOS screen scrolls too fast, errors disappear
|
|
|
|
**Solutions:**
|
|
|
|
1. **Remove |MORE from commands** - causes issues in batch files
|
|
2. **Use PAUSE strategically:**
|
|
```bat
|
|
ECHO Starting backup of %MACHINE%...
|
|
REM ... backup commands ...
|
|
IF ERRORLEVEL 1 GOTO ERROR
|
|
ECHO [OK] Backup completed
|
|
GOTO END
|
|
|
|
:ERROR
|
|
ECHO [ERROR] Backup failed!
|
|
PAUSE Press any key to continue...
|
|
GOTO END
|
|
|
|
:END
|
|
```
|
|
|
|
3. **Compact output:**
|
|
```bat
|
|
ECHO Backup: %MACHINE% to T:\%MACHINE%\BACKUP
|
|
XCOPY /S /Y /Q C:\*.* T:\%MACHINE%\BACKUP
|
|
IF ERRORLEVEL 4 ECHO [ERROR] Insufficient memory
|
|
IF ERRORLEVEL 2 ECHO [ERROR] User terminated
|
|
IF ERRORLEVEL 1 ECHO [ERROR] No files found
|
|
IF NOT ERRORLEVEL 1 ECHO [OK] Complete
|
|
```
|
|
|
|
## Summary of Fixes Needed
|
|
|
|
1. **Machine detection:**
|
|
- Add `SET MACHINE=TS-4R` to AUTOEXEC.BAT
|
|
- UPDATE.BAT checks %MACHINE% first, then %1 parameter
|
|
|
|
2. **T: drive detection:**
|
|
- Replace variable check with actual drive test: `T: 2>NUL` or `IF EXIST T:\NUL`
|
|
- Add error handling for network not started
|
|
|
|
3. **Console output:**
|
|
- Remove |MORE pipes
|
|
- Add PAUSE only on errors
|
|
- Use compact single-line status messages
|
|
|
|
4. **Automatic execution:**
|
|
- Add CALL UPDATE.BAT to end of STARTNET.BAT or AUTOEXEC.BAT
|
|
- Run silently if successful, show errors if failed
|
|
|
|
Next: Create corrected batch files.
|