I am trying to find drive letters and create one tmp.txt file in each drive if i able to create file it should print file created else not. Below what i did but didnt work as expected.
del volumes.txt
del test.log
mountvol | findstr :\ >> volumes.txt
for /F "delims= " %%b in (volumes.txt) do (
for /f "usebackq tokens=* delims=" %%a in (`fsutil file createnew %%btmp.txt 1 2^>^&1`) do (
for /f "tokens=4 delims= " %%# in ("%%a") do set "result=%%~#" (
if %result% equ "created" (
echo File creted >> test.log
) else (
echo Failed to create >> test.log
)
)
)
)
it shows Failed to create for all drives in test.log even if tmp.txt created in drives