回复 1# erjnasrtnws - @echo off & color 0d
- for /f "tokens=2,*" %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Desktop"') do (
- set "desktop_dir=%%j"
- )
-
- ——————————————————————————————————————————————
- set "back_dir=d:\桌面备份\%date:~0,4%-%date:~5,2%桌面备份"
- set "back_dir1=%date:~0,4%-%date:~5,2%桌面备份"
-
- set "back_dir_favo=d:\桌面备份\%date:~0,4%-%date:~5,2%桌面备份\收藏夹"
-
-
- if not exist "d:\桌面备份" (md "d:\桌面备份")
- if not exist "%back_dir%" (md "%back_dir%")
-
- if not exist "%back_dir_favo%" (md "%back_dir_favo%")
-
- 1set "filesdate=%date:~0,4%%date:~5,2%%date:~8,2%"
-
-
- ——————————————————————————————————————————————
- robocopy "%desktop_dir%" "%back_dir%" /move /e /xf *.lnk
-
- robocopy "%userprofile%\Favorites" "d:\00beifen\备份\7Favorites" /mir /w:2 /r:2
-
- robocopy "%userprofile%\Favorites" "%back_dir_favo%" /mir /w:2 /r:2
-
-
- ——————————————————————————————————————————————
- for /f "delims=" %%a in ('dir /a-d /b /s "%desktop_dir%\*.*"') do (
- if "%%~xa" neq ".lnk" (del "%%a" /f /s /q)
- )
-
- for /f "delims=" %%b in ('dir /ad /b /s "%desktop_dir%\"^|sort /r') do (rd "%%b" /s /q)
-
-
- ——————————————————————————————————————————————
- (echo Set objShell=CreateObject^("WScript.Shell"^)
- echo DesktopPath=objShell.SpecialFolders^("Desktop"^)
- echo Set objlink=objShell.CreateShortcut^(DesktopPath ^& "\%back_dir1%.lnk"^)
- echo objlink.Hotkey="CTRL+Q"
- echo objlink.WindowStyle=3
- echo objlink.TargetPath="%back_dir%"
- echo objlink.Save
- )>"%temp%\mysendto.vbs"
- start /wait "" "%temp%\mysendto.vbs"
-
- cls
- ping 127.0.0.1 -n 5 >nul 2>nul
- del /q "%temp%\mysendto.vbs"
-
-
-
- ——————————————————————————————————————————————
- title 重启explorer资源管理器不关闭打开的文件夹
- 1set/p "p=即将重启 Explorer,"<nul & 1pause
-
- Call :_RestartExplorer
- echo 完成!
- 1pause
-
- cls
- ping 127.0.0.1 -n 5 >nul 2>nul
-
- start "" "%back_dir%"
-
- exit
-
-
-
- :: 重启 Explorer
- goto :eof
- :_RestartExplorer
- ( echo Set objWsh = CreateObject^("WScript.Shell"^)
- echo Set objShell = CreateObject^("Shell.Application"^)
- echo For Each objWin In objShell.Windows
- echo If Instr^(LCase^(objWin.FullName^),"\explorer.exe"^) Then
- echo strURL = strURL ^& objWin.LocationURL ^& vbCrLf
- echo End If
- echo Next
- echo If strURL = "" Then WScript.Quit
- echo strURL = Left^(strURL, Len^(strURL^)-Len^(vbCrLf^)^)
- echo arrURL = Split^(strURL, vbCrLf^)
- echo objWsh.run "cmd /c taskkill /f /im explorer.exe & start """" explorer", 0, True
- echo For Each strURL In arrURL
- echo objShell.Explore strURL
- echo Next )>"%temp%\RestartExplorer.vbs"
- CScript //NoLogo "%temp%\RestartExplorer.vbs"
- del /q /f "%temp%\RestartExplorer.vbs"
- goto :eof
复制代码
|