' ' open-with-localhost.vbs ' ' check for missing arguments If (WScript.Arguments.Count < 3) Then errorMessage = "Error: Missing Arguments" & vbNewLine &_ "open-with-localhost.vbs " &_ " " WScript.Echo(errorMessage) WScript.Quit(1) End If ' get the needed arguments filePath = WScript.Arguments(0) webPath = WScript.Arguments(1) physicalPath = WScript.Arguments(2) ' convert all directory seperators filePath = Replace(filePath, "\", "/") webPath = Replace(webPath, "\", "/") physicalPath = Replace(physicalPath, "\", "/") ' replace physicalPath with webPath webFilePath = Replace(filePath, physicalPath, webPath) 'WScript.Echo(webFilePath) ' debugging ' create windows scripting host shell Dim wshShell Set wshShell = WScript.CreateObject("WScript.Shell") ' open file with default application (works with mozilla, other browsers are not tested) wshShell.Run(""""& webFilePath &"""")