使用vcvars32.bat遇到的一个奇葩坑
系统装了各种运行库和IDE
最近需要手动编译OpenSSL所以命令行走起来
然后发现一直报错找不到Windows.h
经过一番倒腾,发现环境变量(%WindowsSdkDir% )一直是 %VCINSTALLDIR%\PlatformSDK\
着显然是不正确的,打开批处理发现有这么个尝试自动定位SDK位置。。
:GetWindowsSdkDir @call :GetWindowsSdkDirHelper HKLM > nul 2>&1 @if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1 @if errorlevel 1 set WindowsSdkDir=%VCINSTALLDIR%\PlatformSDK\ @exit /B 0 :GetWindowsSdkDirHelper @for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') DO ( if "%%i"=="CurrentInstallFolder" ( SET "WindowsSdkDir=%%k" ) )
然后就顺手在Cmd手动执行了一下reg query 发现这个信息显示不太对劲啊。。。
Impacket v0.9.21 - Copyright 2020 SecureAuth Corporation usage: reg.py [-h] [-debug] [-hashes LMHASH:NTHASH] [-no-pass] [-k] [-aesKey hex key] [-dc-ip ip address] [-target-ip ip address] [-port [destination port]] target {query} ... reg.py: error: argument action: invalid choice: '%1\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows' (choose from 'query')
然后Everything搜索reg.* 发现有个reg.py !!!!
而且?:\Python27\Scripts 这个路径是在系统环境变量的所以导致运行的是reg.py 而不是reg.exe。。。
实在是蛋疼