有人从这里给我这个代码,根据用户想要的数量
创建多个文件夹我在想,如果我仍然能够添加一个算法,它会将文件平均移动到创建的文件夹中,我将如何操作?
@echo off
set "FolderCount=1"
set /P "FolderCount=Enter number of folders (default: %FolderCount%): "
for /L %%N in (1,1,%FolderCount%) do md "Folder%%N"
我非常需要它。任何建议,建议和意见将不胜感激。
这就是我做的事情
@echo off
set "FolderCount=1"
set /P "FolderCount=Enter number of folders (default: %FolderCount%): "
for /L %%N in (1,1,%FolderCount%)
do md "Folder%%N"
for %%f (*.txt)
move /y "%%f" "Folder%%N"
set "FolderCount="
答案 0 :(得分:0)
将文件平均复制到创建的文件夹:
@echo off
set "FolderCount=1"
set /P "FolderCount=Enter number of folders (default: %FolderCount%): "
rem next command to treat possible answer `two` etc.
set /A "FolderCount=FolderCount"
for /L %%N in (1,1,%FolderCount%) do (
md "Folder%%N" 2>NUL
copy /y *.txt "Folder%%N\"
)
将文件移动到创建的所有文件夹:
@echo off
set "FolderCount=1"
set /P "FolderCount=Enter number of folders (default: %FolderCount%): "
set /A "FolderCount=FolderCount"
for /L %%N in (1,1,%FolderCount%) do (
md "Folder%%N" 2>NUL
if %%N EQU 1 (
move /y "*.txt" "Folder%%N\"
) else (
copy /y "Folder1\*.txt" "Folder%%N\"
)
)
以copy
/ move
个文件静默使用copy /y *.txt "Folder%%N\" >NUL 2>&1
资源(必读):
%N
等特殊页面)Command Line arguments (Parameters) 2>NUL
,2>&1
等特殊页面)Redirection