So far I can get the drive letters and drive type:
Code: Select all
@echo off
title DefragDotBat
rem set log file name and location
set log=c:\util\DefragDotBat.log
rem get drive letters
set "drlist="
for /f "tokens=*" %%a in ('fsutil fsinfo drives^|find /v ""') do (
set "dr=%%a"
call set drlist=%%drlist%% %%dr:~-3%%
)
rem use drive letters to get drive type
for %%a in (%drlist%) do fsutil fsinfo drivetype %%a >> %log%
rem now defrag fixed drives and exclude optical and remote/network drives
The text file %log% contains the following:
C:\ - Fixed Drive
D:\ - CD-ROM Drive
M:\ - Remote/Network Drive
How do I run dirms.exe only on the fixed drive? I've read a bit about IF and ELSE, but I'm quite confused. Can someone nudge me in the right direction?
Thanks,
Dave