Files
claudetools/DEPLOY_TEST.BAT
Mike Swanson e040cc99ff fix: Remove multi-line IF blocks with parentheses from batch files
Issue: DOS 6.22 does not support multi-line IF ( ... ) blocks or
ELSE clauses, causing "Bad command or file name" errors in DEPLOY.BAT
Step 5 (Updating AUTOEXEC.BAT).

Root cause: Parentheses for multi-line IF blocks were added in later
DOS versions. DOS 6.22 only supports single-line IF statements.

Changes:
- Converted IF ( ... ) ELSE ( ... ) to GOTO label structure
- Converted IF ( nested commands ) to GOTO label structure
- Updated check-dos-compatibility.ps1 to detect IF ( ... ) syntax
- Created fix-if-blocks.ps1 automated fix script

Example fix:
BEFORE (DOS error):
  IF EXIST file (
      command1
      command2
  ) ELSE (
      command3
  )

AFTER (DOS 6.22 compatible):
  IF NOT EXIST file GOTO ELSE_LABEL
  command1
  command2
  GOTO END_LABEL
  :ELSE_LABEL
  command3
  :END_LABEL

Files modified:
- DEPLOY.BAT: Fixed 2 multi-line IF blocks (lines 164, 244)
- Added labels: NO_AUTOEXEC_BACKUP, AUTOEXEC_BACKUP_DONE, ADD_MACHINE_VAR

DOS 6.22 IF syntax:
- Single-line only: IF condition command
- No parentheses: IF condition ( ... )
- No ELSE clause: ) ELSE (
- Use GOTO for multi-step logic

Deployed to:
- D2TESTNAS: /data/test/DEPLOY.BAT (9,848 bytes)

Testing: Should resolve "Bad command or file name" error at Step 5

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

9.3 KiB