mirror of
https://github.com/corpnewt/gibMacOS.git
synced 2024-11-13 10:14:03 +01:00
Update gibMacOS.bat
This commit is contained in:
parent
5f1156cbc3
commit
0a1ca788d1
18
gibMacOS.bat
18
gibMacOS.bat
@ -48,16 +48,16 @@ goto checkpy
|
||||
|
||||
:setcomspec
|
||||
REM Helper method to return the "proper" path to cmd.exe, reg.exe, and where.exe by walking the ComSpec var
|
||||
REM Prep the LF variable to use the "line feed" approach - requires 2 newlines after it to function
|
||||
set LF=^
|
||||
|
||||
|
||||
REM Prep the LF variable to use the "line feed" approach
|
||||
(SET LF=^
|
||||
%=this line is empty=%
|
||||
)
|
||||
REM Strip double semi-colons
|
||||
call :undouble "ComSpec" ";"
|
||||
set "testpath=%ComSpec:;=!LF!%"
|
||||
REM Let's walk each path and test if cmd.exe, reg.exe, and where.exe exist there
|
||||
set /a found=0
|
||||
for /f %%i in ("!testpath!") do (
|
||||
for /f "tokens=* delims=" %%i in ("!testpath!") do (
|
||||
REM Only continue if we haven't found it yet
|
||||
if NOT "%%i" == "" (
|
||||
if !found! lss 1 (
|
||||
@ -103,7 +103,7 @@ REM Remove double semicolons from the adjusted PATH
|
||||
call :undouble "PATH" ";"
|
||||
goto :EOF
|
||||
|
||||
:undouble - string_name character
|
||||
:undouble <string_name> <character>
|
||||
REM Helper function to strip doubles of a single character out of a string recursively
|
||||
set "string_name=%~1"
|
||||
set "character=%~2"
|
||||
@ -164,7 +164,7 @@ if "!pypath!" == "" (
|
||||
)
|
||||
goto runscript
|
||||
|
||||
:checkpyversion - path py2v py2path py3v py3path
|
||||
:checkpyversion <path> <py2v> <py2path> <py3v> <py3path>
|
||||
set "version="&for /f "tokens=2* USEBACKQ delims= " %%a in (`"%~1" -V 2^>^&1`) do (
|
||||
REM Ensure we have a version number
|
||||
call :isnumber "%%a"
|
||||
@ -189,12 +189,12 @@ if "!version:~0,1!" == "2" (
|
||||
)
|
||||
goto :EOF
|
||||
|
||||
:isnumber - check_value
|
||||
:isnumber <check_value>
|
||||
set "var="&for /f "delims=0123456789." %%i in ("%~1") do set var=%%i
|
||||
if defined var (exit /b 1)
|
||||
exit /b 0
|
||||
|
||||
:comparepyversion - version1 version2 return
|
||||
:comparepyversion <version1> <version2> <return>
|
||||
REM Exits with status 0 if equal, 1 if v1 gtr v2, 2 if v1 lss v2
|
||||
for /f "tokens=1,2,3 delims=." %%a in ("%~1") do (
|
||||
set a1=%%a
|
||||
|
Loading…
Reference in New Issue
Block a user