Saved Bookmarks
| 1. |
Solve : How to combine several conditions in command FOR?? |
|
Answer» Hi everyone,
Thanks you I think you are headed in the right direction. Rather than combine them, why not use a subroutine to do the delete. SOMETHING like: Code: [Select]for /F "usebackq" %%i IN (`net view ^| find /i "BAO-"`) DO call delfiles %%1 goto :EOF :Delfiles set compname=%1 del /q "%compname%\%allusersprofile%\Desktop\*.r2w" goto :EOF Interesting solution, but it does not solve my problem... Your syntax is broken Something like this would be: Code: [Select]set target="c$\Documents and Settings" for /F "usebackq" %%i IN (`net view ^| find /i "BAO-"`) DO call delfiles %%1 :delfiles set compname=%1 for /F "usebackq" %%i IN (`dir "%compname%\%target%\*.r2w" /b /s ^| find /i ".r2w"`) DO set xx=%%i && del /q %%i Thanks for the reply.for /f "tokens=*" %%a in ('net view^|find/i "BAO-"') do del/q/s "%%a\c$\docume~1\*.r2w" REM not testedQuote from: Reno on May 07, 2009, 11:11:24 PM for /f "tokens=*" %%a in ('net view^|find/i "BAO-"') do del/q/s "%%a\c$\docume~1\*.r2w" Thanks, you helped me - I miss, the command DEL is also the syntax "/s" Functional and correct syntax should be as follows: Code: [Select]set prefix=BAO- set target="c$\Documents and Settings\*.r2w" for /F "usebackq" %%a IN (`net view ^| find /i "%prefix%"`) DO del /s /q "%%a\%target%" Caution: The syntax is not valid for the PC, which runs the script!! Limited only to networks in the domain. On the local network in the work group also operates, including the PC, which is activated. That's all folks! |
|