FG
💻 Software

Windows Batch File: usebackq, quotes within quotes

Fresh5 days ago
Mar 15, 202636530 views
Confidence Score0%
0%

Problem

Goal: Delete empty folders at end of a mutli-step clean-up. rd without "Force" removes directories that are not empty. This works: These don't work: I know I'm missing something simple... EDIT Adding the example below to the mix: If I actually echo the %d it echos.... "O:\Patient". Not the full nam…

Error Output

for /f "usebackq" %%d in (`"dir O:\Folder~1\Folder /ad/b/s | sort /R"`) do rd "%%d"

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Windows Batch File: usebackq, quotes within quotes

Low Risk

You don't need the (outer) double quotes with . You can get the list of directories from your piped commands, but when the output has spaces, only the first part will go to the variable. To avoid that, use an additional parameter (from ):

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment