- @echo off
- for /f "delims=:" %%i in ('findstr /n "^:DynamicScript$" "%~f0"') do (
- more +%%i "%~f0" > "%temp%\GetU.vbs"
- )
- for /f %%a in ('cscript /nologo "%temp%\GetU.vbs"') do (
- set "DriveU=%%a"
- )
- wmic logicaldisk where "freeSpace>34489761792" get name|find /i "%DriveU%"&&format %DriveU% /fs:fat32 /q /x||echo 无U盘或大于32G无需格式化
- pause
- :DynamicScript
- Set Fso = CreateObject("Scripting.FileSystemObject")
- Set B = Fso.Drives
- For Each A in B
- If A.DriveType = 1 Then
- aDisk = aDisk & A.DriveLetter & ": "
- End If
- Next
- aDisk = Replace(aDisk, "A: ","")
- WScript.Echo aDisk
复制代码
|