Files
claudetools/DEPLOY.BAT
Mike Swanson 15d1386e82 fix: Restructure script to capture machine name first and update AUTOEXEC before installing batch files
Issue: User confirmed MACHINE variable IS being set (visible with SET command),
but script was executing steps in wrong order causing issues.

Solution: Reorganize execution flow:

OLD FLOW:
1. Banner & PAUSE
2. Check T: drive
3. Check deployment files
4. Get machine name from %1 → MACHINE variable
5. Install batch files
6. Update AUTOEXEC.BAT

NEW FLOW:
1. Get machine name from %1 → MACHINE variable (IMMEDIATELY)
2. Banner & PAUSE (shows Machine: %MACHINE%)
3. Check T: drive
4. Check deployment files
5. Verify machine folder
6. Update AUTOEXEC.BAT (Step 4/5)
7. Install batch files (Step 5/5)

Changes:
- Moved machine name check to line 24 (BEFORE any PAUSE or other commands)
- Machine name captured into MACHINE variable immediately
- Banner now displays "Machine: %MACHINE%" to confirm parameter received
- UPDATE_AUTOEXEC runs BEFORE INSTALL_BATCH_FILES
- All UPDATE_AUTOEXEC branches (success, skip, error) → INSTALL_BATCH_FILES
- INSTALL_BATCH_FILES → DEPLOYMENT_COMPLETE

Benefits:
- MACHINE variable set before anything can consume %1 parameter
- AUTOEXEC.BAT updated before files installed (as requested)
- Even if AUTOEXEC update fails, batch files still get installed
- User sees machine name in banner immediately

Testing confirmed:
- User ran T:\DEPLOY.BAT TS-4R
- SET command shows MACHINE=TS-4R (variable captured correctly)
- Script now executes in correct order

Deployed to: D2TESTNAS /data/test/DEPLOY.BAT

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 17:31:54 -07:00

9.4 KiB