290 lines
7.9 KiB
Markdown
290 lines
7.9 KiB
Markdown
# 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
|