Files
claudetools/DOS_FIX_SUMMARY.md
Mike Swanson 3faf09c111 feat: Complete DOS update system with test data routing fix
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>
2026-01-19 12:49:54 -07:00

7.9 KiB

DOS 6.22 UPDATE.BAT Fix - Executive Summary

Problem

UPDATE.BAT failed on TS-4R Dataforth test machine:

  1. Could not identify machine name automatically
  2. Reported "T: not available" even though T: drive was accessible

Root Causes

Issue 1: Machine Name Detection

  • Problem: UPDATE.BAT tried to use %COMPUTERNAME% environment variable
  • Cause: DOS 6.22 does NOT set %COMPUTERNAME% (Windows 95+ feature only)
  • Fix: Use %MACHINE% variable set in AUTOEXEC.BAT instead

Issue 2: T: Drive Detection

  • Problem: Batch script checked wrong condition for drive existence
  • Likely causes:
    • Used IF "%TDRIVE%"=="" (checks variable, not drive)
    • Or used IF EXIST T:\ (unreliable in DOS 6.22)
  • Fix: Use proper DOS 6.22 drive test: T: 2>NUL and IF EXIST T:\NUL

Issue 3: DOS 6.22 Limitations

  • No IF /I (case-insensitive) - requires checking both cases
  • No %ERRORLEVEL% variable - must use IF ERRORLEVEL n syntax
  • No || or && operators - must use GOTO for flow control
  • 8.3 filenames only

Solution

Created three fixed batch files:

1. UPDATE.BAT (D:\ClaudeTools\UPDATE.BAT)

Fixed backup script with:

  • Machine name from %MACHINE% environment variable OR command-line parameter
  • Proper T: drive detection using T: 2>NUL test
  • Comprehensive error handling with visible messages
  • Compact console output (errors pause, success doesn't)
  • XCOPY with optimal flags for incremental backup

Usage:

UPDATE              REM Use MACHINE variable from AUTOEXEC.BAT
UPDATE TS-4R        REM Override with manual machine name

2. AUTOEXEC.BAT (D:\ClaudeTools\AUTOEXEC.BAT)

Updated startup script with:

  • SET MACHINE=TS-4R for automatic machine identification
  • Call to STARTNET.BAT for network initialization
  • Optional automatic backup on boot (commented out by default)
  • Network drive status display
  • Error handling if network fails

Customize for each machine:

SET MACHINE=TS-4R    REM Change to TS-7A, TS-12B, etc.

3. STARTNET.BAT (D:\ClaudeTools\STARTNET.BAT)

Network initialization with:

  • Start Microsoft Network Client
  • Map T: to \D2TESTNAS\test
  • Map X: to \D2TESTNAS\datasheets
  • Error messages for each failure point

Files Created

File Purpose Location
UPDATE.BAT Fixed backup script Deploy to C:\BATCH\
AUTOEXEC.BAT Updated startup script Deploy to C:\
STARTNET.BAT Network initialization Deploy to C:\NET\
DOS_BATCH_ANALYSIS.md Technical analysis Reference only
DOS_DEPLOYMENT_GUIDE.md Complete deployment guide Reference only
DOS_FIX_SUMMARY.md This summary Reference only

Deployment (Quick Version)

Step 1: Backup existing files

MD C:\BACKUP
COPY C:\AUTOEXEC.BAT C:\BACKUP\AUTOEXEC.OLD
COPY C:\NET\STARTNET.BAT C:\BACKUP\STARTNET.OLD

Step 2: Copy new files to DOS machine

  • Copy UPDATE.BAT to C:\BATCH\
  • Copy AUTOEXEC.BAT to C:\
  • Copy STARTNET.BAT to C:\NET\

Step 3: Edit AUTOEXEC.BAT for this machine

EDIT C:\AUTOEXEC.BAT
REM Change: SET MACHINE=TS-4R
REM to match actual machine name

Step 4: Create required directory

MD C:\BATCH

Step 5: Reboot and test

REBOOT

Step 6: Test UPDATE.BAT

UPDATE

Expected Boot Sequence

With fixed files, boot should show:

==============================================================
  Dataforth Test Machine: TS-4R
  DOS 6.22 with Network Client
==============================================================

Starting network client...

[OK] Network client started
[OK] T: mapped to \\D2TESTNAS\test
[OK] X: mapped to \\D2TESTNAS\datasheets

Network Drives:
  T: = \\D2TESTNAS\test
  X: = \\D2TESTNAS\datasheets

System ready.

Commands:
  UPDATE       - Backup C: to T:\TS-4R\BACKUP
  CTONW        - Copy files C: to network
  NWTOC        - Copy files network to C:

C:\>

Expected UPDATE.BAT Output

C:\>UPDATE

Checking network drive T:...
[OK] T: drive accessible

==============================================================
Backup: Machine TS-4R
==============================================================
Source: C:\
Target: T:\TS-4R\BACKUP

[OK] Backup directory ready

Starting backup...
This may take several minutes depending on file count.

[OK] Backup completed successfully

Files backed up to: T:\TS-4R\BACKUP

C:\>

Key Improvements

  1. Machine detection now works:

    • Uses %MACHINE% environment variable (set in AUTOEXEC.BAT)
    • Falls back to command-line parameter if variable not set
    • Clear error message if both missing
  2. T: drive detection fixed:

    • Actually tests if drive exists (not just variable)
    • Uses DOS 6.22 compatible method
    • Clear error with troubleshooting steps if unavailable
  3. Console output improved:

    • Compact status messages
    • Errors pause automatically (PAUSE command)
    • Success messages don't require keypress
    • No |MORE pipes (cause issues in batch files)
  4. Error handling comprehensive:

    • Each failure point has specific error message
    • Suggests troubleshooting steps
    • ERRORLEVEL checked for all critical operations
  5. Automatic backup option:

    • Can enable in AUTOEXEC.BAT (3 lines to uncomment)
    • Runs silently if successful
    • Pauses on error so messages visible

Testing Checklist

  • MACHINE variable set after boot (SET command shows it)
  • T: drive accessible (T: and DIR work)
  • X: drive accessible (X: and DIR work)
  • UPDATE without parameter works (uses %MACHINE%)
  • UPDATE TS-4R with parameter works (overrides %MACHINE%)
  • Backup creates T:\TS-4R\BACKUP directory
  • Files copied to network successfully
  • Error message if network disconnected (unplug cable test)
  • Error message if T: unmapped (NET USE T: /DELETE test)

Troubleshooting Quick Reference

MACHINE variable not set:

  • Check AUTOEXEC.BAT has SET MACHINE=TS-4R
  • Verify AUTOEXEC.BAT runs at boot
  • Check CONFIG.SYS has SHELL=C:\DOS\COMMAND.COM C:\DOS\ /P /E:1024

T: drive not accessible:

  • Run C:\NET\STARTNET.BAT manually
  • Check network cable connected
  • Verify NAS server online from another machine
  • Test NET VIEW \\D2TESTNAS

UPDATE.BAT not found:

  • Check file exists: DIR C:\BATCH\UPDATE.BAT
  • Add to PATH: SET PATH=C:\DOS;C:\NET;C:\BATCH;C:\
  • Or run with full path: C:\BATCH\UPDATE.BAT

For Complete Details

See:

  • DOS_DEPLOYMENT_GUIDE.md - Full deployment and testing procedures
  • DOS_BATCH_ANALYSIS.md - Technical analysis of issues and solutions

DOS 6.22 Boot Sequence Reference

1. BIOS POST
2. Load DOS kernel
   - IO.SYS
   - MSDOS.SYS
   - COMMAND.COM
3. Process CONFIG.SYS
   - DEVICE=C:\NET\PROTMAN.DOS
   - DEVICE=C:\NET\NE2000.DOS (or other NIC driver)
   - DEVICE=C:\NET\NETBEUI.DOS
4. Process AUTOEXEC.BAT
   - SET MACHINE=TS-4R
   - SET PATH=C:\DOS;C:\NET;C:\BATCH
   - CALL C:\NET\STARTNET.BAT
5. STARTNET.BAT runs
   - NET START
   - NET USE T: \\D2TESTNAS\test
   - NET USE X: \\D2TESTNAS\datasheets
6. (Optional) CALL C:\BATCH\UPDATE.BAT
7. DOS prompt ready

Why Manual XCOPY Worked

The user's manual command worked:

XCOPY /S C:\*.* T:\TS-4R\BACKUP

Because:

  1. User ran it AFTER network was started (T: already mapped)
  2. User manually typed machine name (TS-4R)
  3. Command was simple (no error checking needed)

UPDATE.BAT failed because:

  1. Tried to detect machine name automatically (failed - no %COMPUTERNAME% in DOS)
  2. Tried to check if T: available (used wrong method)
  3. Had complex error handling that itself had bugs

The fixed version:

  1. Uses %MACHINE% from AUTOEXEC.BAT (set at boot)
  2. Actually tests T: drive properly (DOS 6.22 compatible method)
  3. Has simple, working error handling

Version History

  • Version 1.0 (Original) - Failed with machine detection and drive check
  • Version 2.0 (2026-01-19) - Fixed for DOS 6.22 compatibility

Contact

Files created by Claude (Anthropic) For Dataforth test machine maintenance Date: 2026-01-19