# Dataforth DOS Machine Update Workflow - Complete Guide

**Version:** 1.0
**Date:** 2026-01-19
**System:** DOS 6.22 with Microsoft Network Client 3.0
**Machines:** TS-4R, TS-7A, TS-12B, and other Dataforth test stations

---

## Table of Contents

1. [Overview](#overview)
2. [Update Path Flow](#update-path-flow)
3. [Batch File Reference](#batch-file-reference)
4. [Common Scenarios](#common-scenarios)
5. [System File Updates](#system-file-updates)
6. [Troubleshooting](#troubleshooting)
7. [Rollback Procedures](#rollback-procedures)

---

## Overview

The Dataforth DOS machine update system provides a safe, automated way to distribute software updates to all test machines. Updates flow from the admin's workstation (AD2) through the NAS (D2TESTNAS) to individual DOS machines.

### Key Features

- **Automatic bidirectional sync** between AD2 and NAS
- **Safe system file updates** with staging and automatic reboot
- **Backup protection** (.BAK and .SAV files created automatically)
- **Rollback capability** in case of update failures
- **Machine-specific** and common updates supported

### Components

**Network Infrastructure:**
- **AD2** (192.168.1.xxx) - Admin workstation, source of updates
- **D2TESTNAS** (172.16.3.30) - Network storage, sync hub
- **TS-XX** (172.16.3.xxx) - DOS test machines (clients)

**Batch Files:**
- **NWTOC.BAT** - Network to Computer (download updates)
- **CTONW.BAT** - Computer to Network (upload local changes)
- **UPDATE.BAT** - Backup entire C:\ to network
- **STAGE.BAT** - Prepare system file updates for reboot
- **REBOOT.BAT** - Apply system file updates after reboot
- **CHECKUPD.BAT** - Check for updates without downloading

---

## Update Path Flow

### Step-by-Step Update Process

```
┌─────────────────────────────────────────────────────────────────┐
│ STEP 1: Admin Places Updates                                   │
├─────────────────────────────────────────────────────────────────┤
│ Admin workstation (AD2):                                        │
│   \\AD2\test\COMMON\ProdSW\*.bat     → Updates for all machines│
│   \\AD2\test\COMMON\DOS\AUTOEXEC.NEW → New AUTOEXEC.BAT        │
│   \\AD2\test\COMMON\DOS\CONFIG.NEW   → New CONFIG.SYS          │
│   \\AD2\test\TS-4R\ProdSW\*.*        → Machine-specific updates│
└─────────────────────────────────────────────────────────────────┘
                            ↓
┌─────────────────────────────────────────────────────────────────┐
│ STEP 2: NAS Sync (Automatic)                                   │
├─────────────────────────────────────────────────────────────────┤
│ D2TESTNAS runs /root/sync-to-ad2.sh every 15 minutes           │
│   Bidirectional sync: \\AD2\test ↔ /mnt/test (NAS)            │
│   Status written to: \\AD2\test\_SYNC_STATUS.txt               │
│   Monitored by: DattoRMM (alerts if sync fails >30 min)        │
└─────────────────────────────────────────────────────────────────┘
                            ↓
┌─────────────────────────────────────────────────────────────────┐
│ STEP 3: DOS Machine Update (Manual or Automatic)               │
├─────────────────────────────────────────────────────────────────┤
│ User runs: NWTOC on DOS machine                                │
│   T:\COMMON\ProdSW\*.bat → C:\BAT\                             │
│   T:\TS-4R\ProdSW\*.bat  → C:\BAT\                             │
│   T:\TS-4R\ProdSW\*.exe  → C:\ATE\                             │
│   T:\COMMON\DOS\*.NEW    → C:\*.NEW (staged)                   │
│                                                                 │
│ If system files detected:                                      │
│   NWTOC.BAT calls STAGE.BAT automatically                      │
└─────────────────────────────────────────────────────────────────┘
                            ↓
┌─────────────────────────────────────────────────────────────────┐
│ STEP 4: System File Staging (If needed)                        │
├─────────────────────────────────────────────────────────────────┤
│ STAGE.BAT:                                                      │
│   1. Copies AUTOEXEC.BAT → AUTOEXEC.SAV (backup)               │
│   2. Copies CONFIG.SYS → CONFIG.SAV (backup)                   │
│   3. Creates REBOOT.BAT with update commands                   │
│   4. Modifies AUTOEXEC.BAT to call REBOOT.BAT once             │
│   5. Tells user to reboot                                      │
└─────────────────────────────────────────────────────────────────┘
                            ↓
┌─────────────────────────────────────────────────────────────────┐
│ STEP 5: Reboot and Apply (Automatic)                           │
├─────────────────────────────────────────────────────────────────┤
│ User reboots machine (Ctrl+Alt+Del)                            │
│                                                                 │
│ During boot, AUTOEXEC.BAT calls REBOOT.BAT:                    │
│   1. Copies C:\AUTOEXEC.NEW → C:\AUTOEXEC.BAT                  │
│   2. Copies C:\CONFIG.NEW → C:\CONFIG.SYS                       │
│   3. Deletes .NEW staging files                                │
│   4. Shows completion message with rollback info               │
│   5. Deletes itself (REBOOT.BAT)                               │
│                                                                 │
│ System continues normal boot with updated files                │
└─────────────────────────────────────────────────────────────────┘
```

### File Flow Diagram

```
AD2 WORKSTATION                 D2TESTNAS (SMB1)              DOS MACHINE (TS-4R)
================                =================             ===================

\\AD2\test\                     T:\ (same as →)               C:\
├── COMMON\                     ├── COMMON\
│   ├── ProdSW\                 │   ├── ProdSW\
│   │   ├── NWTOC.BAT    ─────→ │   │   ├── NWTOC.BAT  ─────→ BAT\NWTOC.BAT
│   │   ├── UPDATE.BAT   ─────→ │   │   ├── UPDATE.BAT ─────→ BAT\UPDATE.BAT
│   │   └── *.bat        ─────→ │   │   └── *.bat      ─────→ BAT\*.bat
│   └── DOS\                    │   └── DOS\
│       ├── AUTOEXEC.NEW ─────→ │       ├── AUTOEXEC.NEW ───→ AUTOEXEC.NEW
│       └── CONFIG.NEW   ─────→ │       └── CONFIG.NEW   ───→ CONFIG.NEW
└── TS-4R\                      └── TS-4R\
    ├── BACKUP\          ←───────── ├── BACKUP\        ←────── (UPDATE.BAT)
    └── ProdSW\                  │   └── ProdSW\
        ├── CUSTOM.BAT   ─────→  │       ├── CUSTOM.BAT ─────→ BAT\CUSTOM.BAT
        ├── TEST.EXE     ─────→  │       ├── TEST.EXE   ─────→ ATE\TEST.EXE
        └── DATA.DAT     ─────→  │       └── DATA.DAT   ─────→ ATE\DATA.DAT

         ↕ sync-to-ad2.sh (bidirectional, every 15 min)
```

---

## Batch File Reference

### NWTOC.BAT - Network to Computer

**Purpose:** Download updates from network to local machine

**Usage:**
```
C:\> NWTOC
```

**What it does:**
1. Verifies MACHINE environment variable is set
2. Checks T: drive is accessible (mapped to \\D2TESTNAS\test)
3. Updates batch files from T:\COMMON\ProdSW\ → C:\BAT\
4. Updates machine-specific files from T:\%MACHINE%\ProdSW\ → C:\BAT\ and C:\ATE\
5. Checks for system file updates (AUTOEXEC.NEW, CONFIG.NEW)
6. If system files found, calls STAGE.BAT automatically
7. Creates .BAK backups of all replaced files

**Exit codes:**
- 0 = Success
- 1 = MACHINE variable not set
- 2 = T: drive not accessible
- 4 = Network directories not found

**Example output:**
```
==============================================================
Update: TS-4R from Network
==============================================================
Source: T:\COMMON and T:\TS-4R
Target: C:\BAT, C:\ATE, C:\NET
==============================================================

[1/4] Updating batch files from T:\COMMON\ProdSW...
      Creating backups (.BAK files)...
      Copying updated files...
      [OK] Batch files updated from COMMON

[2/4] Updating machine-specific files from T:\TS-4R\ProdSW...
      Copying batch files to C:\BAT...
      [OK] Machine-specific batch files updated
      Copying programs to C:\ATE...
      [OK] Machine-specific programs updated

[3/4] Checking for system file updates...
      [FOUND] System file updates available
      Staging AUTOEXEC.BAT and/or CONFIG.SYS updates...

[Calls STAGE.BAT automatically]
```

---

### CTONW.BAT - Computer to Network

**Purpose:** Upload local changes to network for distribution

**Usage:**
```
C:\> CTONW              (upload to T:\TS-4R\ProdSW - machine-specific)
C:\> CTONW MACHINE      (same as above)
C:\> CTONW COMMON       (upload to T:\COMMON\ProdSW - all machines)
```

**What it does:**
1. Verifies MACHINE variable and T: drive
2. Determines upload target (MACHINE or COMMON)
3. Creates target directory if needed
4. Backs up existing files on network (.BAK)
5. Uploads batch files from C:\BAT\
6. If MACHINE target, uploads programs from C:\ATE\

**Warning:**
- Using `CTONW COMMON` affects **ALL** machines on next NWTOC update
- Test locally first before uploading to COMMON

**Example output:**
```
==============================================================
Upload: TS-4R to Network
==============================================================
Source: C:\BAT, C:\ATE
Target: T:\COMMON\ProdSW
Target type: COMMON
==============================================================

[1/2] Uploading batch files from C:\BAT...
      Creating backups on network (.BAK files)...
      Copying files to T:\COMMON\ProdSW...
      [OK] Batch files uploaded

[2/2] Skipping programs/data (COMMON target only gets batch files)

==============================================================
Upload Complete
==============================================================

[WARNING] Files uploaded to COMMON - will affect ALL machines
          Other machines will receive these files on next NWTOC
```

---

### UPDATE.BAT - Full System Backup

**Purpose:** Backup entire C:\ drive to network

**Usage:**
```
C:\> UPDATE              (uses MACHINE variable)
C:\> UPDATE TS-4R        (specify machine name)
```

**What it does:**
1. Backs up C:\*.* → T:\%MACHINE%\BACKUP\
2. Uses XCOPY /D to only copy newer files
3. Preserves directory structure
4. Creates backup directory if needed

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

Starting backup...
[OK] Backup completed successfully
Files backed up to: T:\TS-4R\BACKUP
```

---

### STAGE.BAT - Prepare System File Update

**Purpose:** Stage AUTOEXEC.BAT and CONFIG.SYS updates for safe reboot

**Usage:**
```
C:\> CALL C:\BAT\STAGE.BAT
```

**Normally called by NWTOC.BAT automatically when system files are detected**

**What it does:**
1. Checks for C:\AUTOEXEC.NEW and C:\CONFIG.NEW
2. Backs up current AUTOEXEC.BAT → AUTOEXEC.SAV
3. Backs up current CONFIG.SYS → CONFIG.SAV
4. Creates REBOOT.BAT with update commands
5. Modifies AUTOEXEC.BAT to call REBOOT.BAT once on next boot
6. Displays reboot instructions

**Example output:**
```
==============================================================
Staging System File Updates
==============================================================
  [STAGED] C:\AUTOEXEC.NEW → Will replace AUTOEXEC.BAT
  [STAGED] C:\CONFIG.NEW    → Will replace CONFIG.SYS
==============================================================

[1/3] Backing up current system files...
      [OK] C:\AUTOEXEC.BAT → C:\AUTOEXEC.SAV
      [OK] C:\CONFIG.SYS → C:\CONFIG.SAV

[2/3] Creating reboot update script...
      [OK] C:\BAT\REBOOT.BAT created

[3/3] Modifying AUTOEXEC.BAT for one-time reboot update...
      [OK] AUTOEXEC.BAT modified to run update on next boot

==============================================================
REBOOT REQUIRED
==============================================================

System files have been staged for update.

On next boot, AUTOEXEC.BAT will automatically:
  1. Apply AUTOEXEC.NEW and/or CONFIG.NEW
  2. Delete staging files
  3. Continue normal boot

To apply updates now:
  1. Press Ctrl+Alt+Del to reboot
  2. Or type: EXIT and reboot from DOS prompt

To cancel update:
  1. Delete C:\AUTOEXEC.NEW
  2. Delete C:\CONFIG.NEW
  3. Delete C:\BAT\REBOOT.BAT
  4. Restore C:\AUTOEXEC.BAT from C:\AUTOEXEC.SAV
```

---

### REBOOT.BAT - Apply System Updates

**Purpose:** Apply staged system file updates after reboot

**Usage:**
```
Automatically called by AUTOEXEC.BAT on next boot
(or run manually: C:\> C:\BAT\REBOOT.BAT)
```

**What it does:**
1. Checks for C:\AUTOEXEC.NEW and C:\CONFIG.NEW
2. Backs up current files to .SAV
3. Applies AUTOEXEC.NEW → AUTOEXEC.BAT
4. Applies CONFIG.NEW → CONFIG.SYS
5. Deletes .NEW staging files
6. Displays rollback instructions
7. Deletes itself

**Example output (during boot):**
```
==============================================================
Applying System Updates
==============================================================

[1/2] Updating AUTOEXEC.BAT...
      [OK] AUTOEXEC.BAT updated

[2/2] Updating CONFIG.SYS...
      [OK] CONFIG.SYS updated

==============================================================
System Updates Applied
==============================================================

Backup files saved:
  C:\AUTOEXEC.SAV - Previous AUTOEXEC.BAT
  C:\CONFIG.SAV - Previous CONFIG.SYS

To rollback changes:
  COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT
  COPY C:\CONFIG.SAV C:\CONFIG.SYS
  Then reboot

Press any key to continue boot...
```

---

### CHECKUPD.BAT - Check for Updates

**Purpose:** Check if updates are available without downloading them

**Usage:**
```
C:\> CHECKUPD
```

**What it does:**
1. Checks T:\COMMON\ProdSW\ for newer batch files
2. Checks T:\%MACHINE%\ProdSW\ for machine-specific updates
3. Checks T:\COMMON\DOS\ for system file updates
4. Reports counts without downloading
5. Recommends NWTOC if updates found

**Example output:**
```
==============================================================
Update Check: TS-4R
==============================================================

[1/3] Checking T:\COMMON\ProdSW for batch file updates...
      [FOUND] 3 file(s) available in COMMON

[2/3] Checking T:\TS-4R\ProdSW for machine-specific updates...
      [FOUND] 2 file(s) available for TS-4R

[3/3] Checking T:\COMMON\DOS for system file updates...
      [FOUND] AUTOEXEC.NEW (system reboot required)

==============================================================
Update Summary
==============================================================

Available updates:
  Common files:           3
  Machine-specific files: 2
  System files:           1
  -----------------------------------
  Total:                  6

Recommendation:
  Run NWTOC to download and install updates

  [WARNING] System file updates will require reboot
```

---

## Common Scenarios

### Scenario 1: Update All Machines with New Batch File

**Goal:** Distribute new TESTRUN.BAT to all DOS machines

**Steps:**
1. On AD2, copy TESTRUN.BAT to `\\AD2\test\COMMON\ProdSW\`
2. Wait for NAS sync (max 15 minutes) or run sync manually
3. On each DOS machine, run `NWTOC`
4. TESTRUN.BAT is installed to C:\BAT\

**Verification:**
```
C:\> DIR C:\BAT\TESTRUN.BAT
C:\> TYPE C:\BAT\TESTRUN.BAT
```

---

### Scenario 2: Update One Machine with Custom Test Program

**Goal:** Deploy TEST427.EXE to TS-4R only

**Steps:**
1. On AD2, copy TEST427.EXE to `\\AD2\test\TS-4R\ProdSW\`
2. Wait for NAS sync
3. On TS-4R, run `NWTOC`
4. TEST427.EXE is installed to C:\ATE\

**Verification:**
```
C:\> DIR C:\ATE\TEST427.EXE
C:\> C:\ATE\TEST427.EXE
```

---

### Scenario 3: Deploy New AUTOEXEC.BAT to All Machines

**Goal:** Update all machines with new environment variables

**Steps:**
1. On AD2, edit AUTOEXEC.BAT with new settings
2. Copy to `\\AD2\test\COMMON\DOS\AUTOEXEC.NEW`
3. Wait for NAS sync
4. On each DOS machine:
   ```
   C:\> NWTOC
   [System detects AUTOEXEC.NEW]
   [STAGE.BAT runs automatically]
   [Message: REBOOT REQUIRED]

   C:\> Press Ctrl+Alt+Del to reboot

   [During boot, REBOOT.BAT applies changes]
   [System continues with new AUTOEXEC.BAT]
   ```

**Verification:**
```
C:\> TYPE C:\AUTOEXEC.BAT
[Check for new environment variables]
```

---

### Scenario 4: Test Changes Locally Before Deploying

**Goal:** Test new batch file locally, then share with other machines

**Steps:**
1. On TS-4R, create new batch file in C:\BAT\
2. Test locally: `C:\> C:\BAT\NEWTEST.BAT`
3. If works correctly, upload to network:
   ```
   C:\> CTONW MACHINE
   [File uploaded to T:\TS-4R\ProdSW\]
   ```
4. To share with all machines:
   ```
   C:\> CTONW COMMON
   [WARNING: Will affect ALL machines]
   ```
5. Other machines pull update: `NWTOC`

---

### Scenario 5: Rollback After Bad Update

**Goal:** Restore previous version of batch file

**Steps:**
1. Batch files have .BAK backups:
   ```
   C:\> DIR C:\BAT\*.BAK
   C:\> COPY C:\BAT\NWTOC.BAK C:\BAT\NWTOC.BAT
   ```

2. System files have .SAV backups:
   ```
   C:\> COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT
   C:\> COPY C:\CONFIG.SAV C:\CONFIG.SYS
   C:\> Press Ctrl+Alt+Del to reboot
   ```

---

## System File Updates

### Why System Files Are Special

**AUTOEXEC.BAT** and **CONFIG.SYS** cannot be overwritten while DOS is running:
- COMMAND.COM keeps them open
- Direct overwrite causes corruption
- System must reboot to activate changes

### Safe Update Process

**Staging** ensures atomic updates:
```
1. New files are copied to .NEW files (C:\AUTOEXEC.NEW)
2. Current files are backed up to .SAV files (C:\AUTOEXEC.SAV)
3. REBOOT.BAT is created with update commands
4. AUTOEXEC.BAT is modified to call REBOOT.BAT once
5. User reboots machine
6. During boot, REBOOT.BAT runs BEFORE old AUTOEXEC.BAT
7. Updates are applied, staging files deleted
8. REBOOT.BAT deletes itself
9. Boot continues normally with new files
```

### Anatomy of Modified AUTOEXEC.BAT

**Before STAGE.BAT:**
```bat
@ECHO OFF
REM AUTOEXEC.BAT - DOS 6.22 startup script
SET MACHINE=TS-4R
SET PATH=C:\DOS;C:\NET;C:\BAT
...
```

**After STAGE.BAT (temporary modification):**
```bat
@ECHO OFF
REM One-time system update on next reboot
IF EXIST C:\BAT\REBOOT.BAT CALL C:\BAT\REBOOT.BAT

REM AUTOEXEC.BAT - DOS 6.22 startup script
SET MACHINE=TS-4R
SET PATH=C:\DOS;C:\NET;C:\BAT
...
```

**After reboot (REBOOT.BAT restores original):**
```bat
@ECHO OFF
REM AUTOEXEC.BAT - DOS 6.22 startup script (NEW VERSION)
SET MACHINE=TS-4R
SET PATH=C:\DOS;C:\NET;C:\BAT;C:\TOOLS
...
```

### System File Update Workflow

```
[User runs NWTOC]
        ↓
[NWTOC detects AUTOEXEC.NEW]
        ↓
[NWTOC calls STAGE.BAT]
        ↓
┌────────────────────────────────────┐
│ STAGE.BAT:                         │
│ 1. AUTOEXEC.BAT → AUTOEXEC.SAV     │
│ 2. Create REBOOT.BAT               │
│ 3. Modify AUTOEXEC.BAT (add call)  │
│ 4. Show "REBOOT REQUIRED"          │
└────────────────────────────────────┘
        ↓
[User reboots (Ctrl+Alt+Del)]
        ↓
┌────────────────────────────────────┐
│ Boot sequence:                     │
│ 1. BIOS → DOS kernel               │
│ 2. CONFIG.SYS processed            │
│ 3. AUTOEXEC.BAT starts             │
│ 4. Calls REBOOT.BAT                │
└────────────────────────────────────┘
        ↓
┌────────────────────────────────────┐
│ REBOOT.BAT:                        │
│ 1. AUTOEXEC.NEW → AUTOEXEC.BAT     │
│ 2. CONFIG.NEW → CONFIG.SYS         │
│ 3. Delete .NEW files               │
│ 4. Show completion message         │
│ 5. Delete itself                   │
└────────────────────────────────────┘
        ↓
[Boot continues with new system files]
```

---

## Troubleshooting

### T: Drive Not Available

**Symptoms:**
```
[ERROR] T: drive not available
Network drive T: must be mapped to \\D2TESTNAS\test
```

**Causes:**
1. Network cable unplugged
2. STARTNET.BAT didn't run
3. NAS is offline
4. SMB1 protocol disabled on NAS

**Solutions:**
```bat
REM Check network status
C:\> NET VIEW

REM Restart network client
C:\> C:\NET\STARTNET.BAT

REM Map T: drive manually
C:\> NET USE T: \\D2TESTNAS\test /YES

REM Check if NAS is reachable
C:\> PING 172.16.3.30
```

---

### MACHINE Variable Not Set

**Symptoms:**
```
[ERROR] MACHINE variable not set
Set MACHINE in AUTOEXEC.BAT
```

**Cause:**
AUTOEXEC.BAT is missing `SET MACHINE=TS-4R` line

**Solution:**
1. Edit AUTOEXEC.BAT:
   ```bat
   EDIT C:\AUTOEXEC.BAT
   ```
2. Add line near top (after @ECHO OFF):
   ```bat
   SET MACHINE=TS-4R
   ```
3. Save and reboot, or set temporarily:
   ```bat
   C:\> SET MACHINE=TS-4R
   C:\> NWTOC
   ```

---

### Updates Not Showing Up

**Symptoms:**
- CHECKUPD shows no updates
- Files copied to \\AD2\test but DOS machine doesn't see them

**Causes:**
1. NAS sync hasn't run yet (15 min interval)
2. Sync failed (check _SYNC_STATUS.txt)
3. Wrong directory on AD2

**Solutions:**
```bat
REM Check sync status
C:\> TYPE T:\_SYNC_STATUS.txt

REM Check files on network
C:\> DIR T:\COMMON\ProdSW
C:\> DIR T:\TS-4R\ProdSW

REM Force sync on NAS (SSH to NAS)
guru@d2testnas:~$ sudo /root/sync-to-ad2.sh
```

---

### System File Update Failed

**Symptoms:**
```
[ERROR] AUTOEXEC.BAT update failed
```

**Causes:**
1. Disk full
2. File in use (shouldn't happen with staging)
3. Corrupted .NEW file

**Recovery:**
```bat
REM Restore from backup
C:\> COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT
C:\> COPY C:\CONFIG.SAV C:\CONFIG.SYS

REM Clean up staging files
C:\> DEL C:\AUTOEXEC.NEW
C:\> DEL C:\CONFIG.NEW
C:\> DEL C:\BAT\REBOOT.BAT

REM Reboot
C:\> Press Ctrl+Alt+Del
```

---

### REBOOT.BAT Runs Every Boot

**Symptoms:**
- REBOOT.BAT shows message on every boot
- Updates keep re-applying

**Cause:**
REBOOT.BAT failed to delete itself (probably disk full or read-only)

**Solution:**
```bat
REM Manually delete REBOOT.BAT
C:\> DEL C:\BAT\REBOOT.BAT

REM Restore normal AUTOEXEC.BAT
C:\> COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT

REM Reboot
C:\> Press Ctrl+Alt+Del
```

---

## Rollback Procedures

### Rollback Single Batch File

**If update broke a batch file:**
```bat
REM List backup files
C:\> DIR C:\BAT\*.BAK

REM Restore specific file
C:\> COPY C:\BAT\NWTOC.BAK C:\BAT\NWTOC.BAT
```

---

### Rollback System Files

**If AUTOEXEC.BAT or CONFIG.SYS update broke system:**
```bat
REM From DOS prompt (if system boots):
C:\> COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT
C:\> COPY C:\CONFIG.SAV C:\CONFIG.SYS
C:\> Press Ctrl+Alt+Del to reboot

REM From DOS boot floppy (if system won't boot):
A:\> COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT
A:\> COPY C:\CONFIG.SAV C:\CONFIG.SYS
A:\> Remove floppy
A:\> Press Ctrl+Alt+Del to reboot
```

---

### Rollback All Changes

**Complete restore from network backup:**
```bat
REM Run full backup restore
C:\> XCOPY T:\TS-4R\BACKUP\*.* C:\ /S /E /Y /H /K

REM Reboot
C:\> Press Ctrl+Alt+Del
```

---

## Best Practices

### For Administrators

1. **Test in MACHINE directory first**
   - Deploy to T:\TS-4R\ProdSW\ for testing
   - Test on one machine before COMMON rollout

2. **Use descriptive filenames**
   - Good: `TEST-REV2.EXE`
   - Bad: `TEST.EXE` (ambiguous)

3. **Keep backup of AD2**
   - `\\AD2\test\COMMON\ProdSW\` should have backups
   - Copy to `\\AD2\test\COMMON\ProdSW\archive\YYYY-MM-DD\`

4. **Monitor sync status**
   - Check `\\AD2\test\_SYNC_STATUS.txt` regularly
   - Set up RMM alerts for sync failures

5. **System file updates**
   - Use AUTOEXEC.NEW and CONFIG.NEW (not .BAT and .SYS)
   - Test on one machine before deploying to all

### For DOS Machine Users

1. **Run CHECKUPD before NWTOC**
   - See what will be updated
   - Prepare for reboot if system files present

2. **Run UPDATE before NWTOC**
   - Backup current state before pulling updates
   - Allows rollback from network if needed

3. **Test after updates**
   - Run batch files to verify they work
   - Check AUTOEXEC.BAT variables after reboot

4. **Keep .BAK and .SAV files**
   - Don't delete .BAK files until confident update works
   - .SAV files allow quick rollback

---

## Appendix: File Locations

### On AD2 (Admin Workstation)

```
\\AD2\test\
├── COMMON\
│   ├── ProdSW\              # Batch files for all machines
│   │   ├── NWTOC.BAT        # Update script
│   │   ├── CTONW.BAT        # Upload script
│   │   ├── UPDATE.BAT       # Backup script
│   │   ├── CHECKUPD.BAT     # Update check script
│   │   └── *.bat            # Other batch files
│   ├── DOS\                 # System files for all machines
│   │   ├── AUTOEXEC.NEW     # New AUTOEXEC.BAT for deployment
│   │   └── CONFIG.NEW       # New CONFIG.SYS for deployment
│   └── NET\                 # Network client files (optional)
│       └── *.DOS            # Network drivers
├── TS-4R\                   # Machine TS-4R
│   ├── BACKUP\              # Full backup of TS-4R (UPDATE.BAT writes here)
│   └── ProdSW\              # Machine-specific software
│       ├── *.bat            # Custom batch files for TS-4R
│       ├── *.exe            # Test programs for TS-4R
│       └── *.dat            # Data files for TS-4R
├── TS-7A\                   # Machine TS-7A
└── _SYNC_STATUS.txt         # Sync status (monitored by RMM)
```

### On DOS Machine (TS-4R)

```
C:\
├── AUTOEXEC.BAT             # System startup script
├── AUTOEXEC.SAV             # Backup (created by STAGE.BAT)
├── AUTOEXEC.NEW             # Staged update (if present)
├── CONFIG.SYS               # System configuration
├── CONFIG.SAV               # Backup (created by STAGE.BAT)
├── CONFIG.NEW               # Staged update (if present)
├── DOS\                     # MS-DOS 6.22
├── NET\                     # Microsoft Network Client 3.0
│   ├── STARTNET.BAT         # Network startup
│   ├── PROTOCOL.INI         # Network configuration
│   └── *.DOS                # Network drivers
├── BAT\                     # Batch files directory
│   ├── NWTOC.BAT            # Network to Computer
│   ├── NWTOC.BAK            # Backup
│   ├── CTONW.BAT            # Computer to Network
│   ├── CTONW.BAK            # Backup
│   ├── UPDATE.BAT           # Full system backup
│   ├── UPDATE.BAK           # Backup
│   ├── STAGE.BAT            # System file staging
│   ├── REBOOT.BAT           # System file update (created by STAGE.BAT)
│   ├── CHECKUPD.BAT         # Update checker
│   └── *.BAK                # Backups of all batch files
├── ATE\                     # Automated Test Equipment programs
│   ├── *.EXE                # Test executables
│   ├── *.DAT                # Test data files
│   └── *.LOG                # Test results
└── TEMP\                    # Temporary files
```

### Network Drives (from DOS Machine)

```
T:\ (\\D2TESTNAS\test) - Test file share
  [Same structure as \\AD2\test above]

X:\ (\\D2TESTNAS\datasheets) - Datasheet library
  [Engineering datasheets and documentation]
```

---

**End of Document**

For additional support, contact IT or refer to:
- NWTOC_ANALYSIS.md - Technical analysis and design decisions
- DEPLOYMENT_GUIDE.md - Step-by-step deployment instructions
- DOS_BATCH_ANALYSIS.md - DOS 6.22 limitations and workarounds
