Last active
December 18, 2023 09:20
-
-
Save scruel/73b3b9ac436b71703ee40bca6791c2aa to your computer and use it in GitHub Desktop.
Fix bad address issue on Windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
%1 start "" mshta vbscript:CreateObject("Shell.Application").ShellExecute("%~s0","::","%~dp0","runas",1)(window.close)&&exit | |
SETLOCAL EnableDelayedExpansion | |
set PROGRAM_PATH=%USERPROFILE%\anaconda3 | |
if not exist %PROGRAM_PATH% ( | |
set PROGRAM_PATH=%USERPROFILE%\mambaforge | |
) | |
if not exist %PROGRAM_PATH% ( | |
set PROGRAM_PATH=%USERPROFILE%\miniconda3 | |
) | |
echo %PROGRAM_PATH% | |
:input | |
if not exist "%PROGRAM_PATH%" ( | |
echo Conda folder auto find failed! If you already installed conda, | |
echo Type its home folder (will contain envs folder, empty to quit^) | |
set input_path= | |
set /p input_path= | |
if "!input_path!"=="" ( | |
exit | |
) | |
set PROGRAM_PATH=!input_path! | |
goto input | |
) | |
echo %PROGRAM_PATH% | |
if not exist "NoLsp.exe" ( | |
echo NoLsp.exe not found! Please put it in the same folder before run script! | |
Link: https://www.proxifier.com/tmp/Test20200228/NoLsp.exe | |
pause | |
exit | |
) | |
echo NoLsp Patching... | |
pause | |
echo Patching env base | |
NoLsp.exe %PROGRAM_PATH%\python.exe | |
NoLsp.exe %PROGRAM_PATH%\Scripts\jupyter.exe | |
NoLsp.exe %PROGRAM_PATH%\Scripts\jupyter-notebook.exe | |
for /d %%a in ("%PROGRAM_PATH%\envs\*") do ( | |
if exist "%%a\Scripts\jupyter.exe" ( | |
echo Patching env %%a | |
NoLsp.exe %%a\python.exe | |
NoLsp.exe %%a\Scripts\jupyter.exe | |
) | |
) | |
echo All Done! | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment