I just came over this topic. I’ve been using findstr /v to exclude empty lines:
FOR /f "usebackq skip=1 tokens=1 delims=:" %%a in (`WMIC logicaldisk WHERE "drivetype=3" GET deviceid ^| findstr /v /r "^$"`) do (
More Related Contents:
- How to correct variable overwriting misbehavior when parsing output?
- At which point does `for` or `for /R` enumerate the directory (tree)?
- Batch file: Find if substring is in string (not in a file)
- Iterate all files in a directory using a ‘for’ loop
- Batch character escaping
- How to wait all batch files to finish before exiting?
- How to do something to each file in a directory with a batch script
- Using a custom Tee command for .bat file
- Find out if file is older than 4 hours in Batch file
- Create an empty file on the commandline in windows (like the linux touch command)
- How do I echo and send console output to a file in a bat script?
- Set a persistent environment variable from cmd.exe
- IF… OR IF… in a windows batch file
- Windows batch script to read an .ini file
- Copy text from a Windows CMD window to clipboard
- Using another language (code page) in a batch file made for others
- How can I debug a .BAT script?
- Start multiple tasks in parallel and wait for them in windows?
- Counting in a FOR loop using Windows Batch script
- cmd is somehow writing Chinese text as output
- Special Characters in Batch File
- Batch to remove duplicate rows from text file
- How to pass environment variables as parameters by reference to another batch file?
- Text garble in batch script for wmic command
- Execute multiple batch files concurrently and monitor if their process is completed
- Windows shell command to get the full path to the current directory?
- How can I source variables from a .bat file into a PowerShell script?
- ERRORLEVEL vs %ERRORLEVEL% vs exclamation mark ERRORLEVEL exclamation mark
- How to expand a CMD shell variable twice (recursively)
- Split %date% in a batch file regardless of Regional Settings