Quantcast
Channel: Sysinternals Forums
Viewing all articles
Browse latest Browse all 10386

PsTools : How 2 delete MultipleFolders in 1 PsExec command?

$
0
0
Author: rmetzger
Subject: How 2 delete MultipleFolders in 1 PsExec command?
Posted: 20 July 2014 at 11:59pm

Quote
Yes, or how about this
   psexec \\%PC% cmd /c  for %%U in (1 2 3 4 5 6 7 8 9 T) do (for /d %%D in ("%USERPROFILE%\..\%%U*.*") do (rd /s /q "%%~D"))
Ron Metzger

Quote
You removed the quotes?

Yes, not sure why the quotes were needed in the first place. But if it worked, go for it.

I simply took the alternative batch file example and reduced it down to 1 line. My thought is that if I didn't need them in the multi-line example, the quotes are not needed in the 1 line version.

Note, I added a ~ to the end, to properly unquote any 'quoted' %%D passed to the rd command, given that we are quoting it manually (which would double quote it).

Any way, have fun.
Ron Metzger

Viewing all articles
Browse latest Browse all 10386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>