Option Explicit Dim fso, shell, baseDir, launcher, pyw, py, cmd Set fso = CreateObject("Scripting.FileSystemObject") Set shell = CreateObject("WScript.Shell") baseDir = fso.GetParentFolderName(WScript.ScriptFullName) launcher = baseDir & "\ERPAgentDashboard.pyw" pyw = baseDir & "\.venv\Scripts\pythonw.exe" py = baseDir & "\.venv\Scripts\python.exe" If Not fso.FileExists(launcher) Then MsgBox "ERPAgentDashboard.pyw was not found in " & baseDir, 16, "ERP Local Agent" WScript.Quit End If If fso.FileExists(pyw) Then cmd = """" & pyw & """ """ & launcher & """" ElseIf fso.FileExists(py) Then cmd = """" & py & """ """ & launcher & """" Else MsgBox "ERP Local Agent Python environment was not found.", 16, "ERP Local Agent" WScript.Quit End If shell.Run cmd, 0, False