diff --git a/pyenv-win/bin/pyenv.bat b/pyenv-win/bin/pyenv.bat index b3bc9423..80b379e2 100644 --- a/pyenv-win/bin/pyenv.bat +++ b/pyenv-win/bin/pyenv.bat @@ -142,6 +142,8 @@ if exist "%exe%.bat" ( ) else if exist "%exe%.vbs" ( set "exe=cscript //nologo "%exe%.vbs"" +) else if exist "%exe%.lnk" ( + set "exe=start '' "%exe%.bat"" ) else ( echo pyenv: no such command '%1' exit /b 1 diff --git a/pyenv-win/libexec/libs/pyenv-lib.vbs b/pyenv-win/libexec/libs/pyenv-lib.vbs index 812e2f85..4d9ec877 100644 --- a/pyenv-win/libexec/libs/pyenv-lib.vbs +++ b/pyenv-win/libexec/libs/pyenv-lib.vbs @@ -296,6 +296,23 @@ Function GetExtensionsNoPeriod(addPy) Next End Function +' pyenv - bin - exe files +Sub LinkExeFiles(baseName, file) + ' WScript.echo "kkotari: pyenv-lib.vbs link exe files..!" + Dim filespec + Dim link + link = strDirShims &"\"& baseName &".lnk" + If Not objfs.FileExists(link) Then + Set filespec = objws.CreateShortcut(link) + filespec.TargetPath = file + filespec.Description = baseName + filespec.IconLocation = file &", 2" + filespec.WindowStyle = "1" + filespec.WorkingDirectory = objfs.getParentFolderName(file) + filespec.Save + End If +End Sub + ' pyenv - bin - windows Sub WriteWinScript(baseName) ' WScript.echo "kkotari: pyenv-lib.vbs write win script..!" @@ -369,8 +386,12 @@ Sub Rehash() ' WScript.echo "kkotari: pyenv-lib.vbs rehash for winBinDir" If exts.Exists(LCase(objfs.GetExtensionName(file))) Then baseName = objfs.GetBaseName(file) - WriteWinScript baseName - WriteLinuxScript baseName + If LCase(objfs.GetExtensionName(file)) <> "exe" Then + LinkExeFiles baseName, file + Else + WriteWinScript baseName + WriteLinuxScript baseName + End If End If Next @@ -379,8 +400,12 @@ Sub Rehash() ' WScript.echo "kkotari: pyenv-lib.vbs rehash for winBinDir\Scripts" If exts.Exists(LCase(objfs.GetExtensionName(file))) Then baseName = objfs.GetBaseName(file) - WriteWinScript baseName - WriteLinuxScript baseName + If LCase(objfs.GetExtensionName(file)) <> "exe" Then + LinkExeFiles baseName, file + Else + WriteWinScript baseName + WriteLinuxScript baseName + End If End If Next End If