fix: Complete DOS 6.22 compatibility overhaul for Dataforth update system
Major rewrite of all core batch files to ensure DOS 6.22 compatibility and implement automatic update workflow. Changes: AUTOEXEC.BAT (82 lines): - Rewrote with clean, concise annotations - Fixed 3 NUL device references (changed to *.*) - Added automatic NWTOC + CTONW calls after network start - System now fully automatic (no manual intervention needed) NWTOC.BAT (221 lines): - Rewrote with clean, concise annotations - Fixed 9 NUL device references (changed to *.*) - No functional logic changes, improved clarity CTONW.BAT (272 lines): - Rewrote with clean, concise annotations - Fixed 14 NUL device references (changed to *.*) - Clarified test data routing (ProdSW vs LOGS) DEPLOY.BAT (188 lines, was 391): - Complete simplification per requirements - Removed network drive verification (runs from network) - Removed AUTOEXEC backup logic (template approach) - Template-based AUTOEXEC.BAT installation - Fixed execution order: copy files FIRST, modify AUTOEXEC SECOND - Fixed multi-pipe DOS 6.22 issue (line 92) using temp files - Reduced complexity by 52% deploy-all-to-ad2.ps1 (new): - PowerShell script to deploy all files to AD2 via WinRM - AD2 syncs to NAS automatically Technical fixes: - 24 total NUL device references fixed (DOS 6.22 incompatible) - All files verified with DOS compatibility checker - All false positives confirmed (REM comments, single-line IFs) - DEPLOY.BAT multi-pipe chain broken into temp file steps Deployment: - All files deployed to AD2:C:\Shares\test\COMMON\ProdSW\ - Files will sync to NAS automatically Result: Fully automatic update system for ~30 DOS 6.22 machines. Downloads updates and uploads test data on every boot. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
166
NWTOC.BAT
166
NWTOC.BAT
@@ -1,52 +1,28 @@
|
||||
@ECHO OFF
|
||||
REM NWTOC.BAT - Network to Computer update script
|
||||
REM Pulls software updates from network share to local C: drive
|
||||
REM
|
||||
REM Usage: NWTOC
|
||||
REM
|
||||
REM Updates these directories:
|
||||
REM T:\COMMON\ProdSW\*.bat ??? C:\BAT\
|
||||
REM T:\%MACHINE%\ProdSW\*.* ??? C:\BAT\ and C:\ATE\
|
||||
REM T:\COMMON\DOS\*.NEW ??? Staged for reboot
|
||||
REM
|
||||
REM Version: 1.0 - DOS 6.22 compatible
|
||||
REM Network to Computer - Download software updates from network to local C: drive
|
||||
REM Updates: T:\COMMON\ProdSW -> C:\BAT, T:\%MACHINE%\ProdSW -> C:\BAT and C:\ATE
|
||||
REM Version: 2.0 - DOS 6.22 compatible
|
||||
REM Last modified: 2026-01-19
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 1: Verify machine name is set
|
||||
REM ==================================================================
|
||||
|
||||
REM Verify MACHINE environment variable is set
|
||||
IF NOT "%MACHINE%"=="" GOTO CHECK_DRIVE
|
||||
|
||||
:NO_MACHINE
|
||||
ECHO.
|
||||
ECHO [ERROR] MACHINE variable not set
|
||||
ECHO.
|
||||
ECHO Set MACHINE in AUTOEXEC.BAT:
|
||||
ECHO SET MACHINE=TS-4R
|
||||
ECHO.
|
||||
ECHO Then reboot or run:
|
||||
ECHO SET MACHINE=TS-4R
|
||||
ECHO NWTOC
|
||||
ECHO MACHINE must be set in AUTOEXEC.BAT
|
||||
ECHO Run DEPLOY.BAT to configure this machine
|
||||
ECHO.
|
||||
PAUSE
|
||||
GOTO END
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 2: Verify T: drive is accessible
|
||||
REM ==================================================================
|
||||
|
||||
:CHECK_DRIVE
|
||||
REM Test T: drive access by switching to it
|
||||
REM Verify T: drive is accessible
|
||||
DIR T:\ >nul
|
||||
IF ERRORLEVEL 1 GOTO NO_T_DRIVE
|
||||
|
||||
REM Successfully switched to T:, go back to C:
|
||||
C:
|
||||
|
||||
REM Double-check with NUL device test
|
||||
IF NOT EXIST T:\*.* GOTO NO_T_DRIVE
|
||||
|
||||
GOTO START_UPDATE
|
||||
|
||||
:NO_T_DRIVE
|
||||
@@ -54,83 +30,62 @@ C:
|
||||
ECHO.
|
||||
ECHO [ERROR] T: drive not available
|
||||
ECHO.
|
||||
ECHO Network drive T: must be mapped to \\D2TESTNAS\test
|
||||
ECHO.
|
||||
ECHO Run network startup:
|
||||
ECHO C:\NET\STARTNET.BAT
|
||||
ECHO.
|
||||
ECHO Or map manually:
|
||||
ECHO NET USE T: \\D2TESTNAS\test /YES
|
||||
ECHO Network drive must be mapped to \\D2TESTNAS\test
|
||||
ECHO Run: C:\NET\STARTNET.BAT
|
||||
ECHO.
|
||||
PAUSE
|
||||
GOTO END
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 3: Display update banner
|
||||
REM ==================================================================
|
||||
|
||||
:START_UPDATE
|
||||
ECHO.
|
||||
ECHO ==============================================================
|
||||
ECHO Update: %MACHINE% from Network
|
||||
ECHO Download Updates: %MACHINE% from Network
|
||||
ECHO ==============================================================
|
||||
ECHO Source: T:\COMMON and T:\%MACHINE%
|
||||
ECHO Target: C:\BAT, C:\ATE, C:\NET
|
||||
ECHO ==============================================================
|
||||
ECHO.
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 4: Check if update directories exist
|
||||
REM ==================================================================
|
||||
|
||||
IF NOT EXIST T:\COMMON\NUL GOTO NO_COMMON
|
||||
IF NOT EXIST T:\COMMON\ProdSW\NUL GOTO NO_PRODSW
|
||||
REM Verify update directories exist on network
|
||||
IF NOT EXIST T:\COMMON\*.* GOTO NO_COMMON
|
||||
IF NOT EXIST T:\COMMON\ProdSW\*.* GOTO NO_PRODSW
|
||||
|
||||
REM Machine-specific directory is optional
|
||||
IF NOT EXIST T:\%MACHINE%\NUL GOTO SKIP_MACHINE_CHECK
|
||||
IF NOT EXIST T:\%MACHINE%\ProdSW\NUL GOTO SKIP_MACHINE_CHECK
|
||||
|
||||
IF NOT EXIST T:\%MACHINE%\*.* GOTO SKIP_MACHINE_CHECK
|
||||
IF NOT EXIST T:\%MACHINE%\ProdSW\*.* GOTO SKIP_MACHINE_CHECK
|
||||
GOTO UPDATE_BATCH_FILES
|
||||
|
||||
:NO_COMMON
|
||||
ECHO [ERROR] T:\COMMON directory not found
|
||||
ECHO.
|
||||
ECHO Network share structure is incorrect.
|
||||
ECHO Expected: T:\COMMON\ProdSW\
|
||||
ECHO Network share structure is incorrect
|
||||
ECHO.
|
||||
PAUSE
|
||||
GOTO END
|
||||
|
||||
:NO_PRODSW
|
||||
ECHO [ERROR] T:\COMMON\ProdSW directory not found
|
||||
ECHO.
|
||||
ECHO Update directory is missing.
|
||||
ECHO Expected: T:\COMMON\ProdSW\*.bat
|
||||
ECHO Update directory is missing
|
||||
ECHO.
|
||||
PAUSE
|
||||
GOTO END
|
||||
|
||||
:SKIP_MACHINE_CHECK
|
||||
ECHO [WARNING] T:\%MACHINE%\ProdSW not found - skipping machine-specific updates
|
||||
ECHO [INFO] T:\%MACHINE%\ProdSW not found - skipping machine-specific updates
|
||||
ECHO.
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 5: Update batch files from COMMON
|
||||
REM ==================================================================
|
||||
|
||||
:UPDATE_BATCH_FILES
|
||||
ECHO [1/4] Updating batch files from T:\COMMON\ProdSW...
|
||||
|
||||
REM Create C:\BAT directory if it doesn't exist
|
||||
IF NOT EXIST C:\BAT\NUL MD C:\BAT
|
||||
REM Create C:\BAT directory if needed
|
||||
IF NOT EXIST C:\BAT\*.* MD C:\BAT
|
||||
|
||||
REM Backup existing batch files before update
|
||||
ECHO Creating backups (.BAK files)...
|
||||
FOR %%F IN (C:\BAT\*.BAT) DO COPY %%F %%~dpnF.BAK >NUL 2>NUL
|
||||
|
||||
REM Copy newer batch files from COMMON
|
||||
REM Copy newer batch files from COMMON (only if newer)
|
||||
ECHO Copying updated files...
|
||||
XCOPY T:\COMMON\ProdSW\*.bat C:\BAT\ /D /Y
|
||||
XCOPY T:\COMMON\ProdSW\*.bat C:\BAT\ /D /Y
|
||||
IF ERRORLEVEL 4 GOTO UPDATE_ERROR_INIT
|
||||
IF ERRORLEVEL 2 GOTO UPDATE_ERROR_USER
|
||||
IF ERRORLEVEL 1 ECHO [OK] No new batch files in COMMON
|
||||
@@ -138,18 +93,15 @@ IF NOT ERRORLEVEL 1 ECHO [OK] Batch files updated from COMMON
|
||||
|
||||
ECHO.
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 6: Update machine-specific files
|
||||
REM ==================================================================
|
||||
|
||||
:UPDATE_MACHINE_FILES
|
||||
ECHO [2/4] Updating machine-specific files from T:\%MACHINE%\ProdSW...
|
||||
|
||||
REM Check if machine-specific directory exists
|
||||
IF NOT EXIST T:\%MACHINE%\ProdSW\NUL GOTO SKIP_MACHINE_FILES
|
||||
IF NOT EXIST T:\%MACHINE%\ProdSW\*.* GOTO SKIP_MACHINE_FILES
|
||||
|
||||
REM Create directories if they don't exist
|
||||
IF NOT EXIST C:\BAT\NUL MD C:\BAT
|
||||
IF NOT EXIST C:\ATE\NUL MD C:\ATE
|
||||
REM Create directories if needed
|
||||
IF NOT EXIST C:\BAT\*.* MD C:\BAT
|
||||
IF NOT EXIST C:\ATE\*.* MD C:\ATE
|
||||
|
||||
REM Copy batch files
|
||||
ECHO Copying batch files to C:\BAT...
|
||||
@@ -169,45 +121,37 @@ IF NOT ERRORLEVEL 1 ECHO [OK] Machine-specific data files updated
|
||||
GOTO CHECK_SYSTEM_FILES
|
||||
|
||||
:SKIP_MACHINE_FILES
|
||||
ECHO [SKIP] No machine-specific directory (T:\%MACHINE%\ProdSW)
|
||||
ECHO [SKIP] No machine-specific directory
|
||||
ECHO.
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 7: Check for system file updates
|
||||
REM ==================================================================
|
||||
|
||||
:CHECK_SYSTEM_FILES
|
||||
ECHO [3/4] Checking for system file updates...
|
||||
|
||||
REM Check if DOS directory exists
|
||||
IF NOT EXIST T:\COMMON\DOS\NUL GOTO NO_SYSTEM_FILES
|
||||
REM Check if DOS directory exists on network
|
||||
IF NOT EXIST T:\COMMON\DOS\*.* GOTO NO_SYSTEM_FILES
|
||||
|
||||
REM Check for AUTOEXEC.NEW
|
||||
REM Check for AUTOEXEC.NEW or CONFIG.NEW
|
||||
SET SYSUPD=0
|
||||
IF EXIST T:\COMMON\DOS\AUTOEXEC.NEW SET SYSUPD=1
|
||||
IF EXIST T:\COMMON\DOS\CONFIG.NEW SET SYSUPD=1
|
||||
|
||||
REM If no system updates, continue
|
||||
REM If no system updates, continue to network files
|
||||
IF "%SYSUPD%"=="0" GOTO NO_SYSTEM_FILES
|
||||
|
||||
REM System files need updating - stage them
|
||||
REM System files need updating - stage them for reboot
|
||||
ECHO [FOUND] System file updates available
|
||||
ECHO Staging AUTOEXEC.BAT and/or CONFIG.SYS updates...
|
||||
ECHO.
|
||||
|
||||
REM Copy staging files
|
||||
IF EXIST T:\COMMON\DOS\AUTOEXEC.NEW COPY T:\COMMON\DOS\AUTOEXEC.NEW C:\AUTOEXEC.NEW >NUL
|
||||
IF EXIST T:\COMMON\DOS\CONFIG.NEW COPY T:\COMMON\DOS\CONFIG.NEW C:\CONFIG.NEW >NUL
|
||||
|
||||
REM Call staging script
|
||||
REM Call staging script if it exists
|
||||
IF EXIST C:\BAT\STAGE.BAT GOTO CALL_STAGE
|
||||
|
||||
REM STAGE.BAT doesn't exist - warn user
|
||||
ECHO [WARNING] C:\BAT\STAGE.BAT not found
|
||||
ECHO System files copied to C:\AUTOEXEC.NEW and C:\CONFIG.NEW
|
||||
ECHO Manually copy these files after reboot:
|
||||
ECHO COPY C:\AUTOEXEC.NEW C:\AUTOEXEC.BAT
|
||||
ECHO COPY C:\CONFIG.NEW C:\CONFIG.SYS
|
||||
ECHO Manually copy these files after reboot
|
||||
ECHO.
|
||||
GOTO UPDATE_COMPLETE
|
||||
|
||||
@@ -219,10 +163,7 @@ GOTO END
|
||||
ECHO [OK] No system file updates
|
||||
ECHO.
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 8: Update network client files (optional)
|
||||
REM ==================================================================
|
||||
|
||||
:CHECK_NET_FILES
|
||||
ECHO [4/4] Checking for network client updates...
|
||||
|
||||
REM Check if NET directory exists on network
|
||||
@@ -232,9 +173,9 @@ REM Backup network client files
|
||||
ECHO Creating backups of C:\NET\...
|
||||
FOR %%F IN (C:\NET\*.DOS) DO COPY %%F %%~dpnF.BAK >NUL 2>NUL
|
||||
|
||||
REM Copy newer network files
|
||||
REM Copy newer network files (only if newer)
|
||||
ECHO Copying updated network files...
|
||||
XCOPY T:\COMMON\NET\*.* C:\NET\ /D /Y
|
||||
XCOPY T:\COMMON\NET\*.* C:\NET\ /D /Y
|
||||
IF NOT ERRORLEVEL 1 ECHO [OK] Network client files updated
|
||||
GOTO UPDATE_COMPLETE
|
||||
|
||||
@@ -242,39 +183,26 @@ GOTO UPDATE_COMPLETE
|
||||
ECHO [OK] No network client updates
|
||||
ECHO.
|
||||
|
||||
REM ==================================================================
|
||||
REM STEP 9: Update complete
|
||||
REM ==================================================================
|
||||
|
||||
:UPDATE_COMPLETE
|
||||
ECHO ==============================================================
|
||||
ECHO Update Complete
|
||||
ECHO ==============================================================
|
||||
ECHO.
|
||||
ECHO Files updated from:
|
||||
ECHO T:\COMMON\ProdSW ??? C:\BAT
|
||||
ECHO T:\%MACHINE%\ProdSW ??? C:\BAT and C:\ATE
|
||||
ECHO T:\COMMON\ProdSW -> C:\BAT
|
||||
ECHO T:\%MACHINE%\ProdSW -> C:\BAT and C:\ATE
|
||||
ECHO.
|
||||
ECHO Backup files (.BAK) created in C:\BAT
|
||||
ECHO.
|
||||
ECHO System file updates: %SYSUPD%
|
||||
IF "%SYSUPD%"=="1" ECHO [WARNING] Reboot required to apply system changes
|
||||
IF "%SYSUPD%"=="1" ECHO Run REBOOT command or press Ctrl+Alt+Del
|
||||
IF "%SYSUPD%"=="1" ECHO [WARNING] Reboot required to apply system changes
|
||||
IF "%SYSUPD%"=="1" ECHO Run REBOOT or press Ctrl+Alt+Del
|
||||
ECHO.
|
||||
GOTO END
|
||||
|
||||
REM ==================================================================
|
||||
REM ERROR HANDLERS
|
||||
REM ==================================================================
|
||||
|
||||
:UPDATE_ERROR_INIT
|
||||
ECHO.
|
||||
ECHO [ERROR] Update initialization failed
|
||||
ECHO.
|
||||
ECHO Possible causes:
|
||||
ECHO - Insufficient memory
|
||||
ECHO - Invalid path
|
||||
ECHO - Target drive not accessible
|
||||
ECHO Possible causes: Insufficient memory, invalid path, or drive not accessible
|
||||
ECHO.
|
||||
PAUSE
|
||||
GOTO END
|
||||
@@ -282,17 +210,11 @@ GOTO END
|
||||
:UPDATE_ERROR_USER
|
||||
ECHO.
|
||||
ECHO [ERROR] Update terminated by user (Ctrl+C)
|
||||
ECHO.
|
||||
ECHO Update may be incomplete!
|
||||
ECHO Run NWTOC again to complete update.
|
||||
ECHO Update may be incomplete - run NWTOC again
|
||||
ECHO.
|
||||
PAUSE
|
||||
GOTO END
|
||||
|
||||
REM ==================================================================
|
||||
REM CLEANUP AND EXIT
|
||||
REM ==================================================================
|
||||
|
||||
:END
|
||||
REM Clean up environment variables
|
||||
SET SYSUPD=
|
||||
|
||||
Reference in New Issue
Block a user