From 0c56f1857afef9c289f797666ffb474cf711b588 Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Wed, 12 Aug 2026 21:28:58 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9B=8C=EC=B9=98=EB=8F=85=20=EB=9F=B0?= =?UTF-8?q?=EC=B2=98=EA=B0=80=20powershell.exe=EB=A5=BC=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20=EA=B2=BD=EB=A1=9C=EB=A1=9C=20=ED=98=B8=EC=B6=9C?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EA=B3=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PATH 탐색에 기대면 작업 스케줄러 컨텍스트의 PATH가 로그온 세션과 다를 때 powershell.exe를 찾지 못하고, 그 경우 워치독은 로그 한 줄 없이 실패만 남긴다. %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe로 고정한다. --- scripts/watch-public-runtime-task.vbs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/watch-public-runtime-task.vbs b/scripts/watch-public-runtime-task.vbs index 9c59687..1b7a0e3 100644 --- a/scripts/watch-public-runtime-task.vbs +++ b/scripts/watch-public-runtime-task.vbs @@ -10,8 +10,9 @@ ' 경로를 하드코딩하지 않으므로 stable source root 가 바뀌어도 이 파일은 그대로 쓴다. Option Explicit -Dim objShell, args, i, arg, cmd, exitCode, dryRun +Dim objShell, args, i, arg, cmd, exitCode, dryRun, psExe +Set objShell = CreateObject("WScript.Shell") Set args = WScript.Arguments If args.Count = 0 Then WScript.Echo "usage: watch-public-runtime-task.vbs -File -StableSourceRoot ..." @@ -22,8 +23,11 @@ If LCase(args(0)) = "syntax-only" Then WScript.Quit 0 End If +' PATH 탐색에 기대지 않는다. 작업 스케줄러 컨텍스트의 PATH 는 로그온 세션과 다를 수 +' 있고, 그때 powershell.exe 를 못 찾으면 워치독은 로그 한 줄 없이 실패만 남긴다. dryRun = False -cmd = "powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden" +psExe = objShell.ExpandEnvironmentStrings("%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe") +cmd = """" & psExe & """ -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden" For i = 0 To args.Count - 1 arg = args(i) If i = 0 And LCase(arg) = "print-command" Then @@ -40,6 +44,5 @@ If dryRun Then WScript.Quit 0 End If -Set objShell = CreateObject("WScript.Shell") exitCode = objShell.Run(cmd, 0, True) WScript.Quit exitCode