2014-03-05 252 views
0

你好我有此脚本这是为我做蝙蝠脚本文件夹中删除括号 - 即括号

@echo off 
rem Eliminate all folders present at the same level of the Batch file 
rem and move their contents one level up 
for /F "delims=" %%a in ('dir /B /AD') do (
    cd "%%a" 
    for /F "delims=" %%b in ('dir /B /AD') do (
     move "%%b" .. 
    ) 
    move *.* .. 
    cd .. 
    rd "%%a" 
) 

它删除的文件夹,并清空该文件夹到这个脚本运行中的文件。

它工作正常,但一个问题。如果文件夹名称中有括号“()”,则不起作用。可以将其改为允许使用括号

干杯

+3

对于美国读者,在这方面“括号”会提到括号,我承担。 '('和')'而不是''',''','<', or '>'。 – Gray

+0

对不起() – Xencored

+1

你会得到什么错误? –

回答

0

的尝试这个

@echo off 
for /f "delims=" %%A in ('dir /ad /b') do if exist "%%~A" (
    for /f "delims=" %%B in ('dir /b "%%~A"') do move "%%~fB" .\ 
    rd "%%~A" 
)