中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-13 22:14
47,812 topics / 349,916 posts / today 0 new / 48,268 members
论坛回收站 » Where is there a mistake?
Printable Version  8,947 / 2
Floor1 huangapple Posted 2011-01-10 01:10
新手上路 Posts 5 Credits 12
The correct code should be:

for %%i in (c d e f ) do (for /r "%%i" %%j in (*.txt) do copy "%%j" E:\1 \y >nul)

The original code had a syntax error in the "for /r" part. The "for /r" should specify the root directory properly with the correct syntax.
Floor2 andyrave Posted 2011-01-10 03:42
新手上路 Posts 8 Credits 15
@echo off
for %%i in (c d e f ) do (
for /f "delims=" %%j in ('dir /a-d /s /b "%%i:\*.txt"') do (
xcopy /y "%%j" e:\1
))>nul

[ Last edited by andyrave on 2011-1-10 at 03:45 ]
Floor3 Hanyeguxing Posted 2011-01-10 07:59
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
for %%i in (c d e f ) do (for /r %%i %%j in (*.txt) do copy "%%j" E:\1 \y >nul)
for %%a in (set) do clause
1, Among all forms of for: In the extended parameter part, outside (set) and the clause, %%a, delayed variable!a!, etc. are not allowed, but %1 or directly extended variable %a% can be used
2, This path generally needs to be enclosed in quotes

[ Last edited by Hanyeguxing on 2011-1-10 at 09:37 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023