Skip to content

🐛 Fix VBScript quote escaping in launcher files (use \"\" not \\\")#93

Merged
J-MaFf merged 3 commits intomainfrom
fix/vbs-quote-escaping
Mar 27, 2026
Merged

🐛 Fix VBScript quote escaping in launcher files (use \"\" not \\\")#93
J-MaFf merged 3 commits intomainfrom
fix/vbs-quote-escaping

Conversation

@J-MaFf
Copy link
Copy Markdown
Owner

@J-MaFf J-MaFf commented Mar 27, 2026

What does this PR do?

Fixes invalid VBScript quote escaping introduced in PR #92. The previous fix used \" (backslash-quote) to embed double-quotes inside the VBScript string — that is C/JSON-style escaping and is not valid VBScript syntax. wscript.exe was silently running a malformed command (the backslashes were passed literally to the shell, causing pwsh to fail to launch).

Correct VBScript escaping uses "" (two consecutive double-quotes) to represent a single literal ".

Before:

CreateObject("WScript.Shell").Run "\"C:\Program Files\PowerShell\7\pwsh.exe\" ... -File \"...ps1\"", 0, False

After:

CreateObject("WScript.Shell").Run """C:\Program Files\PowerShell\7\pwsh.exe"" ... -File ""...ps1""", 0, False

The resulting command passed to the shell is now correctly:

"C:\Program Files\PowerShell\7\pwsh.exe" -WindowStyle Hidden -ExecutionPolicy Bypass -NonInteractive -File "C:\PowerShellScripts\Scripts\iKAT\Invoke-FFmpegCapture\Start-DinaRecording.ps1"

Files changed:

  • Scripts/iKAT/Invoke-FFmpegCapture/Start-DinaRecording.vbs
  • Scripts/iKAT/Invoke-FFmpegCapture/Start-JoeyRecording.vbs

Why are we doing this?

After merging #92, manual testing showed a wscript.exe process launching in dpuerner's session but no pwsh.exe starting and no debug log entry — confirming the VBS was running but the command was malformed. The \" sequences caused the shell to receive literal backslashes before the path, preventing pwsh from resolving.

How should this be tested?

  1. Pull on server: git pull
  2. Kill any hanging wscript: Stop-Process -Name wscript -Force
  3. Manually run: Start-ScheduledTask -TaskName "iKAT-Record-Dina" (while dpuerner is logged on)
  4. Wait ~5 seconds — confirm a dpuerner_*.ts file appears in C:\Recordings
  5. Check C:\Recordings\debug.log for Script started. USERNAME=dpuerner

Any deployment notes?

Pull on server and kill the currently hanging wscript instance from the previous broken run:

Invoke-Command -Session $s {
    Set-Location C:\PowerShellScripts
    git pull
    Stop-Process -Name wscript -Force -ErrorAction SilentlyContinue
}

@J-MaFf J-MaFf added the bug Something isn't working label Mar 27, 2026
@J-MaFf J-MaFf self-assigned this Mar 27, 2026
@J-MaFf J-MaFf merged commit 7ed6083 into main Mar 27, 2026
1 check failed
@J-MaFf J-MaFf deleted the fix/vbs-quote-escaping branch March 27, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant