-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgetHashMd5Code.bat
More file actions
16 lines (12 loc) · 821 Bytes
/
getHashMd5Code.bat
File metadata and controls
16 lines (12 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
:: get string (e.g. url, filePath) has md5 code , to avoid repeat thing
:: usage example : .\getHashMd5Code.bat bbb "D:\work\svnRepo\shenxiaolong\core\shell_script\batch_env\common\getHashMd5Code.bat"
:: set bbb=a9fe80d9a6fd07b79269df5c1e3e7128
:: python version
:: python -c "import hashlib; h = hashlib.md5(); h.update(""%WORK_DIR%"".encode(""utf-8"")); print(h.hexdigest()[0:8])" > dir.name || goto :ERROR
:: set /p build_suffix=<dir.name || goto :ERROR
:: set "SHORT_BUILD_DIR=%BUILD_ROOT_DIR%\jnk-%build_suffix%" || goto :ERROR
:: on Linux:
:: echo "to generate md5 string" | md5sum
:: set mdStr=`"to generate md5 string" | md5sum | cut -d"-" -f1 -`
:: C:\Program Files\Git\usr\bin\md5sum.exe
@for /f "usebackq tokens=1" %%a in ( ` echo "%~2" ^| md5sum ` ) do echo set %~1=%%~a