Skip to content

Instantly share code, notes, and snippets.

@composite
Created December 12, 2021 04:32
Show Gist options
  • Save composite/20fa6a9144010879811f8c9b742642c0 to your computer and use it in GitHub Desktop.
Save composite/20fa6a9144010879811f8c9b742642c0 to your computer and use it in GitHub Desktop.
A Temporary solution for msedge.exe is not respond in Application folder. find recent edge version and run real msedge.exe
Function GetRecentFolder(path)
On Error Resume Next
Dim fso, folder, version
Set fso = CreateObject("Scripting.FileSystemObject")
Set GetRecentFolder = Nothing
For Each folder in fso.GetFolder(path).SubFolders
version = CInt(Left(folder.Name, Instr(folder.Name, ".") - 1))
If Err.Number = 0 And version > 0 Then
Set GetRecentFolder = folder
Else
'WScript.Echo Err.Description & ": " & folder.Name & " is not number: " & Left(folder.Name, Instr(folder.Name, ".") - 1)
Err.Clear
End If
Next
On Error Goto 0
End Function
Dim recentFile, WshShell, ArgList
Set recentFile = GetRecentFolder(Mid(WScript.ScriptFullName, 1, (Len(WScript.ScriptFullName) - Len(WScript.ScriptName))))
If recentFile is Nothing Then
WScript.Echo "No edge version folders found"
Else
ReDim ArgList(WScript.Arguments.Count-1)
For i = 0 To WScript.Arguments.Count-1
ArgList(i) = WScript.Arguments(i)
Next
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run recentFile.Name & "\msedge.exe " & Join(ArgList, " "), 0
Set WshShell = Nothing
End If
@composite
Copy link
Author

How to use

  1. Download and copy this vbs file to %PROGRAMFILESX86%\Microsoft\Edge\Application or msedge installed to.
  2. Enter properties that any shortcut as you need.
  3. executable file set to msedge.vbs instead of msedge.exe
  4. Double click edited shortcut and check it runs.

Well, I'm considering running another chromium app instead of msedge. or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment