利用群内pcl提供混编VBS生成,去除所有延迟变量,去除for内tokens分割参数[超出数值范围会出现错误数值],可以合并到其他区域
-
- @echo off&chcp 936
- for /f "delims=" %%i in ('wmic logicaldisk where driveType^="3" get caption^,freespace^,size /value')do if /i not "%%i"=="" (
- for /f "delims=" %%j in ("%%i")do (
- for /f "delims==" %%k in ("%%j")do (
- if /i "%%k"=="caption" (set "#%%j"
- )else if /i "%%k"=="freespace" (set "#%%j"
- for /f "delims==" %%c in ('call echo,%%#%%k%%')do (
- call set "#calc#=%%c"&&call :calc&&for /f "delims==" %%d in ('call echo,[盘符:"%%#caption%%" ][剩余:单位: B "%%#calc_result#%%" ]')do echo,%%d
- call set "#calc#=%%c/1024"&&call :calc&&for /f "delims==" %%d in ('call echo,[盘符:"%%#caption%%" ][剩余:单位:KB "%%#calc_result#%%" ]')do echo,%%d
- call set "#calc#=%%c/1024/1024"&&call :calc&&for /f "delims==" %%d in ('call echo,[盘符:"%%#caption%%" ][剩余:单位:MB "%%#calc_result#%%" ]')do echo,%%d
- call set "#calc#=%%c/1024/1024/1024"&&call :calc&&for /f "delims==" %%d in ('call echo,[盘符:"%%#caption%%" ][剩余:单位:GB "%%#calc_result#%%" ]')do echo,%%d
- )
- )else if /i "%%k"=="size" (set "#%%j"
- for /f "delims==" %%c in ('call echo,%%#%%k%%')do (
- call set "#calc#=%%c"&&call :calc&&for /f "delims==" %%d in ('call echo,[盘符:"%%#caption%%" ][容量:单位: B "%%#calc_result#%%" ]')do echo,%%d
- call set "#calc#=%%c/1024"&&call :calc&&for /f "delims==" %%d in ('call echo,[盘符:"%%#caption%%" ][容量:单位:KB "%%#calc_result#%%" ]')do echo,%%d
- call set "#calc#=%%c/1024/1024"&&call :calc&&for /f "delims==" %%d in ('call echo,[盘符:"%%#caption%%" ][容量:单位:MB "%%#calc_result#%%" ]')do echo,%%d
- call set "#calc#=%%c/1024/1024/1024"&&call :calc&&for /f "delims==" %%d in ('call echo,[盘符:"%%#caption%%" ][容量:单位:GB "%%#calc_result#%%" ]')do echo,%%d
- )
- )
- )
- )
- )
- pause
- goto :eof
- :calc
- for /f "delims=" %%c in ('mshta.exe "vbscript:createobject("scripting.filesystemobject").getstandardstream(1).write(%#calc#%)(close)"') do if /i "%%~nc"=="" (set "#calc_result#=0%%~xc")else (set "#calc_result#=%%~nxc")
- goto :eof
复制代码
|