Set WshShell = WScript.CreateObject("WScript.Shell")

If WScript.Arguments.Count = 0 Then
    WScript.Echo "Error: No location and filename provided. Please pass the parameters."
    WScript.Quit
End If

Dim WinVer
WinVer = WScript.Arguments(0)

Dim Location
Location = WScript.Arguments(1)

Dim Filename
Filename = WScript.Arguments(2)

If WinVer = "Win10" Then
WshShell.Run "rundll32.exe keymgr.dll,KRShowKeyMgr"
WScript.Sleep 1500
WshShell.AppActivate "Stored User Names and Passwords"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WshShell.SendKeys Location
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys Filename
WScript.Sleep 200
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{TAB}"
WScript.Sleep 200
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
End If

If WinVer = "Win11" Then
WshShell.Run "rundll32.exe keymgr.dll,KRShowKeyMgr"
WScript.Sleep 1500
WshShell.AppActivate "Stored User Names and Passwords"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 300
WshShell.SendKeys Location
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 100
WshShell.SendKeys "{TAB}"
WScript.Sleep 500
WshShell.SendKeys Filename
WScript.Sleep 200
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{TAB}"
WScript.Sleep 200
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
End If
