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>
14 KiB
NWTOC.BAT System Analysis - Dataforth DOS Machine Updates
Analysis Date: 2026-01-19 System: DOS 6.22 with Microsoft Network Client 3.0 Target Machines: TS-4R, TS-7A, TS-12B, and other Dataforth test stations
Current State
Existing Infrastructure
UPDATE.BAT (Backup - Computer to Network)
- Backs up entire C:\ to T:[MACHINE]\BACKUP
- Uses XCOPY /S /E /Y /D /H /K /C /Q
- Supports machine name from %MACHINE% environment variable or command-line parameter
- Fixed for DOS 6.22 on 2026-01-19
- Status: WORKING
STARTNET.BAT (Network Client Startup)
- Starts Microsoft Network Client (NET START)
- Maps T: to \D2TESTNAS\test
- Maps X: to \D2TESTNAS\datasheets
- Called from AUTOEXEC.BAT during boot
- Status: WORKING
AUTOEXEC.BAT (System Startup)
- Sets MACHINE environment variable (e.g., SET MACHINE=TS-4R)
- Configures PATH, PROMPT, TEMP
- Calls STARTNET.BAT to initialize network
- Mentions NWTOC and CTONW commands but they don't exist yet
- Status: WORKING, needs NWTOC/CTONW integration
Missing Components
NWTOC.BAT (Network to Computer - MISSING)
- Should pull updates from T:\COMMON\ProdSW\ and T:[MACHINE]\ProdSW\
- Should update C:\BAT, C:\ATE, C:\NET\
- Should handle AUTOEXEC.BAT and CONFIG.SYS updates safely
- Should trigger reboot when system files change
- Status: DOES NOT EXIST - Must create
CTONW.BAT (Computer to Network - MISSING)
- Should upload local changes to network for sharing
- Counterpart to NWTOC.BAT
- Status: DOES NOT EXIST - Must create
Update Workflow Architecture
Update Path Flow
STEP 1: Admin Places Updates
\\AD2\test\COMMON\ProdSW\*.bat → All machines get these
\\AD2\test\COMMON\DOS\AUTOEXEC.NEW → New AUTOEXEC.BAT for all
\\AD2\test\COMMON\DOS\CONFIG.NEW → New CONFIG.SYS for all
\\AD2\test\TS-4R\ProdSW\*.* → Machine-specific updates
STEP 2: NAS Sync (Automatic, bidirectional)
D2TESTNAS: /root/sync-to-ad2.sh
Syncs: \\AD2\test ↔ /mnt/test (NAS local storage)
Frequency: Every 15 minutes (cron job)
STEP 3: DOS Machine Update (Manual or Automatic)
User runs: NWTOC
Or: Called from AUTOEXEC.BAT at boot
T:\COMMON\ProdSW\*.bat → C:\BAT\
T:\TS-4R\ProdSW\*.bat → C:\BAT\
T:\TS-4R\ProdSW\*.exe → C:\ATE\
T:\COMMON\DOS\AUTOEXEC.NEW → C:\AUTOEXEC.BAT (via staging)
T:\COMMON\DOS\CONFIG.NEW → C:\CONFIG.SYS (via staging)
STEP 4: Reboot (If system files changed)
NWTOC.BAT detects AUTOEXEC.NEW or CONFIG.NEW
Calls STAGE.BAT to prepare reboot
STAGE.BAT modifies AUTOEXEC.BAT to call REBOOT.BAT once
User reboots (or automatic reboot)
REBOOT.BAT applies changes, deletes itself
Critical Problems to Solve
Problem 1: System File Updates Are Dangerous
Issue: Cannot overwrite AUTOEXEC.BAT or CONFIG.SYS while DOS is running
Why it matters:
- COMMAND.COM keeps files open
- Overwriting causes corruption or crash
- System becomes unbootable if interrupted
Solution: File Staging
REM NWTOC.BAT detects new system files
IF EXIST T:\COMMON\DOS\AUTOEXEC.NEW GOTO STAGE_UPDATES
IF EXIST T:\COMMON\DOS\CONFIG.NEW GOTO STAGE_UPDATES
:STAGE_UPDATES
REM Copy to staging area
COPY T:\COMMON\DOS\AUTOEXEC.NEW C:\AUTOEXEC.NEW
COPY T:\COMMON\DOS\CONFIG.NEW C:\CONFIG.NEW
REM Call staging script
CALL C:\BAT\STAGE.BAT
REM Tell user to reboot
ECHO.
ECHO [WARNING] System files updated - reboot required
ECHO.
ECHO Run: REBOOT command or press Ctrl+Alt+Del
PAUSE
Problem 2: Users Don't Know When to Reboot
Issue: System file changes require reboot but user doesn't know
Why it matters:
- Updated AUTOEXEC.BAT doesn't take effect until reboot
- Machine runs with outdated configuration
- New software might depend on new environment variables
Solution: Automatic Reboot Detection
REM STAGE.BAT modifies AUTOEXEC.BAT to run REBOOT.BAT once
REM Backup current AUTOEXEC.BAT
COPY C:\AUTOEXEC.BAT C:\AUTOEXEC.SAV
REM Add one-time reboot call to top of AUTOEXEC.BAT
ECHO @ECHO OFF > C:\AUTOEXEC.TMP
ECHO IF EXIST C:\BAT\REBOOT.BAT CALL C:\BAT\REBOOT.BAT >> C:\AUTOEXEC.TMP
TYPE C:\AUTOEXEC.BAT >> C:\AUTOEXEC.TMP
COPY C:\AUTOEXEC.TMP C:\AUTOEXEC.BAT
DEL C:\AUTOEXEC.TMP
REM Create REBOOT.BAT
ECHO @ECHO OFF > C:\BAT\REBOOT.BAT
ECHO ECHO Applying system updates... >> C:\BAT\REBOOT.BAT
ECHO IF EXIST C:\AUTOEXEC.NEW COPY C:\AUTOEXEC.NEW C:\AUTOEXEC.BAT >> C:\BAT\REBOOT.BAT
ECHO IF EXIST C:\CONFIG.NEW COPY C:\CONFIG.NEW C:\CONFIG.SYS >> C:\BAT\REBOOT.BAT
ECHO DEL C:\AUTOEXEC.NEW >> C:\BAT\REBOOT.BAT
ECHO DEL C:\CONFIG.NEW >> C:\BAT\REBOOT.BAT
ECHO COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT >> C:\BAT\REBOOT.BAT
ECHO DEL C:\BAT\REBOOT.BAT >> C:\BAT\REBOOT.BAT
Problem 3: File Update Verification
Issue: How do we know if update succeeded or failed?
Why it matters:
- Network glitch could corrupt files
- Partial updates leave machine broken
- No way to roll back
Solution: Date/Size Comparison and Backup
REM Use XCOPY /D to copy only newer files
XCOPY /D /Y T:\COMMON\ProdSW\*.bat C:\BAT\
REM Keep .BAK backups
FOR %%F IN (C:\BAT\*.BAT) DO (
IF EXIST %%F COPY %%F %%~nF.BAK
)
REM Verify critical files
IF NOT EXIST C:\BAT\NWTOC.BAT GOTO UPDATE_FAILED
IF NOT EXIST C:\BAT\UPDATE.BAT GOTO UPDATE_FAILED
Problem 4: Update Order Dependencies
Issue: Files might depend on each other (PATH changes, new utilities)
Why it matters:
- New batch files might call new executables
- New AUTOEXEC.BAT might reference new directories
- Wrong order = broken system
Solution: Staged Update Order
REM 1. Update system files first (staged for reboot)
REM AUTOEXEC.BAT, CONFIG.SYS
REM 2. Update network client files
REM C:\NET\*.* (if needed)
REM 3. Update batch files
REM C:\BAT\*.bat
REM 4. Update test programs last
REM C:\ATE\*.*
DOS 6.22 Limitations
Cannot Use (These are Windows NT/2000/XP features)
IF /I(case-insensitive) → Must use exact case%ERRORLEVEL%variable → Must useIF ERRORLEVEL nFOR /Floops → Only simple FOR loops work&&and||operators → Must use GOTO- Long filenames → 8.3 only (NWTOC.BAT not NETWORK-TO-COMPUTER.BAT)
IF EXIST path\*.extwith wildcards → Must use DIR or FOR loop
Must Use
IF ERRORLEVEL nchecks if errorlevel >= n (not ==)- Check highest error levels first (5, 4, 2, 1, 0)
- Case-sensitive string comparison (
TS-4R≠ts-4r) CALLfor batch file subroutinesGOTOlabels for flow control- FOR loops:
FOR %%F IN (*.TXT) DO ECHO %%F
Checking for Drive Existence
WRONG:
IF EXIST T:\ GOTO DRIVE_OK
IF "%T%"=="" ECHO No T drive
CORRECT:
REM Method 1: Try to switch to drive
T: 2>NUL
IF ERRORLEVEL 1 GOTO NO_T_DRIVE
C:
GOTO DRIVE_OK
REM Method 2: Check for NUL device
IF NOT EXIST T:\NUL GOTO NO_T_DRIVE
Checking for Files with Wildcards
WRONG:
IF EXIST T:\COMMON\DOS\*.NEW GOTO HAS_UPDATES
CORRECT:
REM Use FOR loop
SET HASUPDATES=0
FOR %%F IN (T:\COMMON\DOS\*.NEW) DO SET HASUPDATES=1
IF "%HASUPDATES%"=="1" GOTO HAS_UPDATES
File Organization
Network Share Structure
T:\ (\\D2TESTNAS\test)
├── COMMON\ # Files for all machines
│ ├── ProdSW\ # Production software (batch files, tools)
│ │ ├── NWTOC.BAT # Update script (all machines get this)
│ │ ├── UPDATE.BAT # Backup script
│ │ ├── CHECKUPD.BAT # Check for updates
│ │ └── *.bat # Other batch files
│ └── DOS\ # DOS system files
│ ├── AUTOEXEC.NEW # New AUTOEXEC.BAT for deployment
│ ├── CONFIG.NEW # New CONFIG.SYS for deployment
│ └── *.SYS # Device drivers
├── TS-4R\ # Machine-specific files
│ ├── BACKUP\ # Full machine backup (UPDATE.BAT writes here)
│ └── ProdSW\ # Machine-specific software
│ ├── *.bat # Custom batch files for this machine
│ ├── *.exe # Test programs for this machine
│ └── *.dat # Configuration data
├── TS-7A\ # Another machine
└── _SYNC_STATUS.txt # NAS sync status (monitored by RMM)
Local DOS Machine Structure
C:\
├── AUTOEXEC.BAT # System startup (sets MACHINE variable)
├── AUTOEXEC.SAV # Backup before staging
├── AUTOEXEC.NEW # Staged update (if present)
├── CONFIG.SYS # System configuration
├── CONFIG.NEW # Staged update (if present)
├── DOS\ # MS-DOS 6.22 files
├── NET\ # Microsoft Network Client 3.0
│ ├── PROTOCOL.INI # Network configuration
│ ├── STARTNET.BAT # Network startup script
│ └── *.DOS # Network drivers
├── BAT\ # Batch file directory
│ ├── NWTOC.BAT # Network to Computer (get updates)
│ ├── CTONW.BAT # Computer to Network (push changes)
│ ├── UPDATE.BAT # Backup to network
│ ├── STAGE.BAT # Stage system file updates
│ ├── REBOOT.BAT # Apply updates after reboot (auto-deletes)
│ ├── CHECKUPD.BAT # Check for updates without applying
│ └── *.BAK # Backup copies of batch files
├── ATE\ # Test programs (Automated Test Equipment)
│ ├── *.EXE # Test executables
│ ├── *.DAT # Test data files
│ └── *.LOG # Test result logs
└── TEMP\ # Temporary files
Success Criteria
Updates Must Work Automatically
- User runs
NWTOCcommand - All newer files are copied from network
- System files are staged properly
- User is clearly notified of reboot requirement
- Progress is visible and doesn't scroll off screen
System Files Update Safely
- AUTOEXEC.BAT and CONFIG.SYS are never corrupted
- Backup copies are always created (.SAV files)
- Updates are atomic (all or nothing via staging)
- Rollback is possible if update fails
Reboot Happens When Needed
- STAGE.BAT detects system file changes
- AUTOEXEC.BAT is modified to call REBOOT.BAT once
- REBOOT.BAT applies changes and self-deletes
- Normal AUTOEXEC.BAT is restored after update
- User sees clear "reboot required" message
Errors Are Visible
- Don't scroll off screen (use PAUSE on errors)
- Show clear [OK], [WARNING], [ERROR] markers
- Indicate what went wrong (drive not mapped, file not found, etc.)
- Provide recovery instructions
Progress Is Clear
- Show what's being updated
- Show where files are coming from/going to
- Show file count or progress indicator
- Compact output (one line per operation)
Rollback Is Possible
- Keep .BAK files of all batch files
- Keep .SAV files of system files
- Document rollback procedure in comments
- Allow manual restoration if needed
Implementation Plan
Phase 1: Core Update Scripts (Priority 1)
-
NWTOC.BAT - Network to Computer update
- Copy batch files from T:\COMMON\ProdSW\ → C:\BAT\
- Copy machine-specific files from T:%MACHINE%\ProdSW\ → C:\BAT\ and C:\ATE\
- Detect AUTOEXEC.NEW and CONFIG.NEW
- Call STAGE.BAT if system files need updating
- Show clear progress and status
-
STAGE.BAT - Prepare for system file update
- Copy AUTOEXEC.NEW → C:\AUTOEXEC.NEW
- Copy CONFIG.NEW → C:\CONFIG.NEW
- Backup current AUTOEXEC.BAT → C:\AUTOEXEC.SAV
- Create REBOOT.BAT
- Modify AUTOEXEC.BAT to call REBOOT.BAT once
- Show "reboot required" warning
-
REBOOT.BAT - Apply staged updates (runs once after reboot)
- Check if running (first line of AUTOEXEC.BAT)
- Apply AUTOEXEC.NEW → AUTOEXEC.BAT
- Apply CONFIG.NEW → CONFIG.SYS
- Delete staging files (.NEW files)
- Restore original AUTOEXEC.BAT (remove REBOOT.BAT call)
- Delete itself
- Show completion message
Phase 2: Supporting Scripts (Priority 2)
-
CTONW.BAT - Computer to Network
- Opposite of NWTOC.BAT
- Upload local changes to T:%MACHINE%\ProdSW\
- Used when testing new batch files locally
- Allows sharing between machines
-
CHECKUPD.BAT - Check for updates
- Compare file dates: T:\COMMON\ProdSW\ vs C:\BAT\
- Report what would be updated
- Don't actually copy files
- Quick status check
Phase 3: Integration (Priority 3)
-
Update AUTOEXEC.BAT
- Add optional NWTOC call (commented out by default)
- Add CHECKUPD call to show status on boot
- Document MACHINE variable requirement
-
Create deployment documentation
- DEPLOYMENT_GUIDE.md - How to deploy updates
- UPDATE_WORKFLOW.md - Complete workflow explanation
- TROUBLESHOOTING.md - Common issues and fixes
Next Steps
- Create NWTOC.BAT with full DOS 6.22 compatibility
- Create STAGE.BAT for safe system file updates
- Create REBOOT.BAT for post-reboot application
- Create CHECKUPD.BAT for status checking
- Create CTONW.BAT for uploading local changes
- Create comprehensive documentation
- Test on actual TS-4R machine
- Deploy to all Dataforth DOS machines
References
- DOS_BATCH_ANALYSIS.md - Original UPDATE.BAT analysis and DOS 6.22 limitations
- UPDATE.BAT - Working backup script (C:\ to network)
- STARTNET.BAT - Network client startup script
- AUTOEXEC.BAT - System startup script with MACHINE variable
- Dec 14, 2025 Session - Original NWTOC/CTONW batch files (imported conversation)
- File Structure Documentation - .claude/FILE_ORGANIZATION.md
Status: Analysis complete, ready for implementation Author: Claude Code (coordinator) Date: 2026-01-19