john
john

Reputation: 43

Understanding dir %%a 1>nul 2>nul in batch file

Got this batch file which does exactly what I want, however I don't fully understand what its coding is doing can somebody run me through it?

@echo off
for /F %%a in ('mountvol ^| find ":\"') do (
dir %%a 1>nul 2>nul
if not ErrorLevel 1 (
del /s /f %%ahuntthisfile.txt
del /s /f %%aandthisfiletoo.txt
)
)

particularly the dir %%a 1>nul 2>nul has got me stuck.

Upvotes: 1

Views: 820

Answers (1)

adritha84
adritha84

Reputation: 1017

I think that dir %%a 1>nul 2>nul lists the content of the folder, and it redirects the command output to the null device.

Upvotes: 1

Related Questions