这个论坛上有人帮我开发了一个批量文件,可以根据当月的情况将文件从一个文件夹移到另一个文件夹,如下所示:
::echo You were in %cd% ran from batch file "%~f0"
pushd "%~dp0"
::echo You are in now in %cd%
::popd
::@Echo off&SetLocal EnableExtensions EnableDelayedExpansion
::Set "Dir1=C:\Directory1"
::Set "Dir2=C:\Directory2"
@Echo off&SetLocal EnableExtensions EnableDelayedExpansion
set "Dir1=%cd%"
::echo %Dir1%
set "Dir2=%cd%"
::echo %Dir2%
:: Build Mon[01..12] array
Set Cnt=100
For %%A in (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
) Do Set /A Cnt+=1&Set Mon[!Cnt:~-2!]=%%A
::Set Mon[
For /f "delims=" %%A in (
' Dir /B/A-D "%Dir1%\?-??-???? - * - *.pdf" ^|findstr "[01][0-9][0-3]
[0-9] 20 [0-9][0-9]\.pdf$" '
) Do (
Set "File=%%~nA"
Call Set "MoveTo=%Dir2%\!File:~-4!\%%Mon[!File:~-8,2!]%%\"
MD "!MoveTo!" >Nul 2>&1
Move "%%~fA" "!MoveTo!"
)
popd这个脚本运行得很好,但是它不能处理命名为"符号的文件,例如:'10"'。
有没有人可以帮我修改这个脚本,让这个符号得到处理。
提前感谢!
发布于 2017-07-18 22:03:05
文件名中允许使用扩展字符U+201C和U+201D。确保您的脚本为UTF8,并尝试使用这些字符。
" U+0022 Double quotation mark <= not this one
“ U+201C Left double quotation mark
” U+201D Right double quotation markhttps://stackoverflow.com/questions/45155530
复制相似问题