Reputation: 5538
I have this:
FOR /f "delims=" %%a in ('c:\\Program Files (x86)\\Android\\android-sdk\\platform-tools\\adb.exe\ logcat -d -v raw ^| find "BBTests" ^| more') do (
@echo %%a
)
How can I escape the space in "program files"? I've tried:
FOR /f "delims=" %%a in ("""c:\\Program Files (x86)\\Android\\android-sdk\\platform-tools\\adb.exe\"" logcat -d -v raw ^| find "BBTests" ^| more") do (
but %%a captures the for loop line text instead of logcat command output.
If I set that path as an env, then running the below works:
FOR /f "delims=" %%a in ('adb logcat -d -v raw ^| find "BBTests" ^| more') do (
Upvotes: 0
Views: 52
Reputation: 38719
I would assume you would do it like this:
@For /F Delims^= %%G In ('^""%ProgramFiles(x86)%\Android\android-sdk\platform-tools\adb.exe" logcat -d -v raw ^| "%SystemRoot%\System32\find.exe" "BBTests" ^| "%SystemRoot%\System32\more.com"^"') Do @Echo %%G
Or if you prefer not to use the %ProgramFiles(x86)%
variable:
@For /F Delims^= %%G In ('^""C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" logcat -d -v raw ^| "%SystemRoot%\System32\find.exe" "BBTests" ^| "%SystemRoot%\System32\more.com"^"') Do @Echo %%G
Upvotes: 1