【方案一】以点结尾的文件夹 | | | md "C:\test" | | md "C:\test\batcher..\"COPY |
| | | | | ren "C:\test\BATCHE~1" "batcher"COPY |
| | | ren "C:\test\batcher" "batcher../"COPY |
| | | start "" "C:\test\batcher..\"COPY |
| | | copy "C:\test\a.txt" "C:\test\batcher..\"COPY |
| | | | | del /a /f /q "C:\test\NEW~1\a.txt"COPY |
| | | @echo off | | set DstFolder=C:\test\batcher. | | >"%temp%\FolderProperty.vbs" echo Set objFSO = CreateObject("Scripting.FileSystemObject").GetFolder("\\?\%DstFolder%.\") | | >>"%temp%\FolderProperty.vbs" echo objFSO.Attributes=objFSO.Attributes+2 | | cscript /nologo "%temp%\FolderProperty.vbs"COPY |
| | | rd /s /q "C:\test\batcher..\"COPY |
【方案二】以空格结尾的文件夹基本操作与方案一大致相同,此处不再赘述。COPY 【方案三】系统保留字文件夹(Con, Prn, Aux, Nul, Lpt1, Com1, Com2) | | | md "C:\test\batcher" | | md "C:\test\batcher\con\"COPY |
| | | start "" "C:\test\batcher\con\"COPY |
| | | copy "C:\test\batcher\a.txt" "C:\test\batcher\con\"COPY |
| | | del /a /f /q "C:\test\batcher\con\a.txt"COPY |
| | | @echo off | | set DstFolder=C:\test\batcher\con | | >"%temp%\FolderProperty.vbs" echo Set objFSO = CreateObject("Scripting.FileSystemObject").GetFolder("\\?\%DstFolder%.\") | | >>"%temp%\FolderProperty.vbs" echo objFSO.Attributes=objFSO.Attributes+2 | | cscript /nologo "%temp%\FolderProperty.vbs"COPY |
| | | rd /s /q "C:\test\batcher\con\"COPY |
【方案四】特殊字符文件夹(\, /, :, *, ?, ", <, >, |) | | | @echo off | | set "DstFolder=C:\test\batcherA\" | | if exist "%DstFolder%\" ( | | echo 文件夹%DstFolder%已存在 | | goto :eof | | ) | | md "%DstFolder%" | | >"%DstFolder%\desktop.ini" echo [.ShellClassInfo] | | >>"%DstFolder%\desktop.ini" echo LocalizedResourceName=BatHome,-1 | | attrib +s +h "%DstFolder%\desktop.ini" | | >%temp%\UnlockReg.txt echo HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\LocalizedResourceName [9] | | regini %temp%\UnlockReg.txt | | >%temp%\LockReg.txt echo HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\LocalizedResourceName [8] | | >>%temp%\LockReg.txt echo "BatHome,-1" = REG_SZ "|" | | regini %temp%\LockReg.txt | | attrib +s "%DstFolder%"COPY |
| | | @echo off | | set "DstFolder=C:\test\batcherB\" | | if exist "%DstFolder%\" ( | | | | | | | | echo 文件夹%DstFolder%已存在 | | goto :eof | | ) | | md "%DstFolder%" | | >"%DstFolder%\desktop.ini" echo [.ShellClassInfo] | | >>"%DstFolder%\desktop.ini" echo LocalizedResourceName=BatHome,-1 | | attrib +s +h "%DstFolder%\desktop.ini" | | >"\\?\%DstFolder%\nul" echo. | | attrib +s +h "%DstFolder%\desktop.ini" | | >%temp%\UnlockReg.txt echo HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\LocalizedResourceName [9] | | regini %temp%\UnlockReg.txt | | >%temp%\LockReg.txt echo HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\LocalizedResourceName [8] | | >>%temp%\LockReg.txt echo "BatHome,-1" = REG_SZ "|" | | regini %temp%\LockReg.txt | | attrib +r +a +s +h "\\?\%DstFolder%\nul" | | echo y|cacls "\\?\%DstFolder%\nul" /d everyone>nul | | attrib +s +r "%DstFolder%"COPY |
【方案五】以点结尾的文件 | | | md "C:\test" | | echo bbs.bathome.net>"\\?\C:\test\batcher."COPY |
| | | notepad "\\?\C:\test\batcher."COPY |
| | | copy "\\?\C:\test\batcher." "\\?\C:\"COPY |
| | | @echo off | | set DstFile=C:\test\batcher. | | >"%temp%\FileProperty.vbs" echo Set objFSO = CreateObject("Scripting.FileSystemObject").GetFile("\\?\%DstFile%.\") | | >>"%temp%\FileProperty.vbs" echo objFSO.Attributes=objFSO.Attributes+2 | | cscript /nologo "%temp%\FileProperty.vbs"COPY |
| | | del /a /f /q "\\?\C:\test\batcher."COPY |
【方案六】系统保留字文件(Con, Prn, Aux, Nul, Lpt1, Com1, Com2) | | | md "C:\test\batcher" | | echo bbs.bathome.net>"\\?\C:\test\batcher\con"COPY |
| | | notepad "\\?\C:\test\batcher\con"COPY |
| | | copy "\\?\C:\test\batcher\con" "\\?\C:\test"COPY |
| | | @echo off | | set DstFile=C:\test\batcher\con | | >"%temp%\FileProperty.vbs" echo Set objFSO = CreateObject("Scripting.FileSystemObject").GetFile("\\?\%DstFile%.\") | | >>"%temp%\FileProperty.vbs" echo objFSO.Attributes=objFSO.Attributes+2 | | cscript /nologo "%temp%\FileProperty.vbs"COPY |
| | | del /a /f /q "\\?\C:\test\batcher\con"COPY |
|