用户目录迁移,库迁移

  每次重装系统都要备份桌面、文档、图片、音乐、视频、下载等,非常麻烦。思路就是把用户目录下的目录设置到其他盘的目录,以后重装系统再把目录设置到上一系统设置的位置,这样所有的文件都换在,更重要的是不会占用C盘的空间,可以说是一举两得。
  脚本在win10,win7上测试通过。
  脚本在哪运行,目录就会被迁移到哪,当然也可以自己定义路径,只需要修改下面变量的路径即可,%~dp0代表脚本所在目录,也可以修改成绝对路径。

set DocumentsDir=%~dp0Documents
set DesktopDir=%~dp0Desktop
set DownloadsDir=%~dp0Downloads
set FontsDir=%~dp0Fonts
set FavoritesDir=%~dp0Favorites
set PicturesDir=%~dp0Pictures
set VideosDir=%~dp0Videos
set MusicDir=%~dp0Music
set SavedGamesDir=%~dp0Saved Games
set ContactsDir=%~dp0Contacts
set LinksDir=%~dp0Links
set SearchesDir=%~dp0Searches

下面是批处理代码和copyx命令的代码:

copyx是AutoIt3编写的,用来调用系统自带的复制文件对话框的命令。运行脚本前请将此代码编译成copyx.exe并放在批处理的目录下即可,否则将不会复制文件,可能造成文件丢失。

@echo off
title 一键迁移库-作者:曹磊
set cd=%~dp0
rem set cd=%cd:~0,-1%
set DocumentsDir=%cd%Documents
set DesktopDir=%cd%Desktop
set DownloadsDir=%cd%Downloads
set FontsDir=%cd%Fonts
set FavoritesDir=%cd%Favorites
set PicturesDir=%cd%Pictures
set VideosDir=%cd%Videos
set MusicDir=%cd%Music
set SavedGamesDir=%cd%Saved Games
set ContactsDir=%cd%Contacts
set LinksDir=%cd%Links
set SearchesDir=%cd%Searchesset regPath1=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
set regPath2=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Foldersecho 正在检测系统,请稍候...
call :CreateRedReg
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}"') do set Current_Saved_Games=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\{56784854-C6CB-462B-8169-88E350ACB882}"') do set Current_Contacts=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}"') do set Current_Links=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}"') do set Current_Searches=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\{374DE290-123F-4565-9164-39C4925E467B}"') do set Current_Downloads=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\Favorites"'                             ) do set Current_Favorites=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\My Video"'                              ) do set Current_My_Video=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\My Pictures"'                           ) do set Current_My_Pictures=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\Personal"'                              ) do set Current_Personal=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\My Music"'                              ) do set Current_My_Music=%%a
for /f "delims=" %%a in ('cscript //nologo "%cd%RedReg.vbs" "%regPath1%\Desktop"'                               ) do set Current_Desktop=%%a
del "%cd%RedReg.vbs"
cls
echo 当前目标文件夹位置:
echo.
echo 『文档』         %Current_Personal%      --^>      %DocumentsDir%
echo 『桌面』         %Current_Desktop%        --^>      %DesktopDir%
echo 『下载』         %Current_Downloads%      --^>      %DownloadsDir%
echo 『收藏夹』       %Current_Favorites%      --^>      %FavoritesDir%
echo 『图片』         %Current_My_Pictures%       --^>      %PicturesDir%
echo 『视频』         %Current_My_Video%         --^>      %VideosDir%
echo 『音乐』         %Current_My_Music%          --^>      %MusicDir%
echo 『保存的游戏』   %Current_Saved_Games%    --^>      %SavedGamesDir%
echo 『联系人』       %Current_Contacts%       --^>      %ContactsDir%
echo 『链接』         %Current_Links%          --^>      %LinksDir%
echo 『搜索』         %Current_Searches%       --^>      %SearchesDir%
echo.
set /p isCopy=是否复制原目录下的所有文件 Y [Y^|N]:
if not "%isCopy%"=="Y" if not "%isCopy%"=="N" if not "%isCopy%"=="y" if not "%isCopy%"=="n" set isCopy=Y
if "%isCopy%"=="y" set isCopy=Y
if "%isCopy%"=="n" set isCopy=N
set /p isDel=是否删除原来的目录 Y [Y^|N]:
if not "%isDel%"=="Y" if not "%isDel%"=="N" if not "%isDel%"=="y" if not "%isDel%"=="n" set isDel=Y
if "%isDel%"=="y" set isDel=Y
if "%isDel%"=="n" set isDel=N
echo.
echo 您的输入是:%isCopy% %isDel%
echo.
echo 按任意键开始迁移!
>nul 2>nul pause::##########################『文档』##########################
echo 正在处理『文档』...
if not exist "%DocumentsDir%" md "%DocumentsDir%"
if "%isCopy%"=="Y" if not "%DocumentsDir%"=="%Current_Personal%" copyx "%Current_Personal%\*" "%DocumentsDir%"
>nul 2>nul call :PersonalIco %DocumentsDir%
>nul 2>nul attrib -r +a +s -h "%DocumentsDir%"
>nul 2>nul reg add "%regPath1%" /f /v "Personal" /t REG_SZ /d "%DocumentsDir%"
>nul 2>nul reg add "%regPath2%" /f /v "Personal" /t REG_EXPAND_SZ /d "%DocumentsDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{F42EE2D3-909F-4907-8871-4C22FC0BF756}" /t REG_EXPAND_SZ /d "%DocumentsDir%"
if "%isDel%"=="Y" if not "%DocumentsDir%"=="%Current_Personal%" echo.正在删除:"%Current_Personal%" & rd /s /q "%Current_Personal%">nul 2>nul::##########################『桌面』##########################
echo 正在处理『桌面』...
if not exist "%DesktopDir%" md "%DesktopDir%"
if "%isCopy%"=="Y" if not "%DesktopDir%"=="%Current_Desktop%" copyx "%Current_Desktop%\*" "%DesktopDir%"
>nul 2>nul call :DesktopIco %DesktopDir%
>nul 2>nul attrib -r +a +s -h "%DesktopDir%"
>nul 2>nul reg add "%regPath1%" /f /v "Desktop" /t REG_SZ /d "%DesktopDir%"
>nul 2>nul reg add "%regPath2%" /f /v "Desktop" /t REG_EXPAND_SZ /d "%DesktopDir%"
if "%isDel%"=="Y" if not "%DesktopDir%"=="%Current_Desktop%" echo.正在删除:"%Current_Desktop%" & rd /s /q "%Current_Desktop%">nul 2>nul::##########################『下载』##########################
echo 正在处理『下载』...
if not exist "%DownloadsDir%" md "%DownloadsDir%"
if "%isCopy%"=="Y" if not "%DownloadsDir%"=="%Current_Downloads%" copyx "%Current_Downloads%\*" "%DownloadsDir%"
>nul 2>nul call :DownloadsIco %DownloadsDir%
>nul 2>nul attrib -r +a +s -h "%DownloadsDir%"
>nul 2>nul reg add "%regPath1%" /f /v "{374DE290-123F-4565-9164-39C4925E467B}" /t REG_SZ /d "%DownloadsDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{374DE290-123F-4565-9164-39C4925E467B}" /t REG_EXPAND_SZ /d "%DownloadsDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{7D83EE9B-2244-4E70-B1F5-5393042AF1E4}" /t REG_EXPAND_SZ /d "%DownloadsDir%"
if "%isDel%"=="Y" if not "%DownloadsDir%"=="%Current_Downloads%" echo.正在删除:"%Current_Downloads%" & rd /s /q "%Current_Downloads%">nul 2>nul::##########################『收藏夹』##########################
echo 正在处理『收藏夹』...
if not exist "%FavoritesDir%" md "%FavoritesDir%"
if "%isCopy%"=="Y" if not "%FavoritesDir%"=="%Current_Favorites%" copyx "%Current_Favorites%\*" "%FavoritesDir%"
>nul 2>nul call :FavoritesIco %FavoritesDir%
>nul 2>nul attrib -r +a +s -h "%FavoritesDir%"
>nul 2>nul reg add "%regPath1%" /f /v "Favorites" /t REG_SZ /d "%FavoritesDir%"
>nul 2>nul reg add "%regPath2%" /f /v "Favorites" /t REG_EXPAND_SZ /d "%FavoritesDir%"
if "%isDel%"=="Y" if not "%FavoritesDir%"=="%Current_Favorites%" echo.正在删除:"%Current_Favorites%" & rd /s /q "%Current_Favorites%">nul 2>nul::##########################『图片』##########################
echo 正在处理『我的图片』...
if not exist "%PicturesDir%" md "%PicturesDir%"
if "%isCopy%"=="Y" if not "%PicturesDir%"=="%Current_My_Pictures%" copyx "%Current_My_Pictures%\*" "%PicturesDir%"
>nul 2>nul call :PicturesIco %PicturesDir%
>nul 2>nul attrib -r +a +s -h "%PicturesDir%"
>nul 2>nul reg add "%regPath1%" /f /v "My Pictures" /t REG_SZ /d "%PicturesDir%"
>nul 2>nul reg add "%regPath2%" /f /v "My Pictures" /t REG_EXPAND_SZ /d "%PicturesDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{0DDD015D-B06C-45D5-8C4C-F59713854639}" /t REG_EXPAND_SZ /d "%PicturesDir%"
if "%isDel%"=="Y" if not "%PicturesDir%"=="%Current_My_Pictures%" echo.正在删除:"%Current_My_Pictures%" & rd /s /q "%Current_My_Pictures%">nul 2>nul::##########################『视频』##########################
echo 正在处理『视频』...
if not exist "%VideosDir%" md "%VideosDir%"
if "%isCopy%"=="Y" if not "%VideosDir%"=="%Current_My_Video%" copyx "%Current_My_Video%\*" "%VideosDir%"
>nul 2>nul call :VideosIco %VideosDir%
>nul 2>nul attrib -r +a +s -h "%VideosDir%"
>nul 2>nul reg add "%regPath1%" /f /v "My Video" /t REG_SZ /d "%VideosDir%"
>nul 2>nul reg add "%regPath2%" /f /v "My Video" /t REG_EXPAND_SZ /d "%VideosDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{35286A68-3C57-41A1-BBB1-0EAE73D76C95}" /t REG_EXPAND_SZ /d "%VideosDir%"
if "%isDel%"=="Y" if not "%VideosDir%"=="%Current_My_Video%" echo.正在删除:"%Current_My_Video%" & rd /s /q "%Current_My_Video%">nul 2>nul::##########################『音乐』##########################
echo 正在处理『音乐』...
if not exist "%MusicDir%" md "%MusicDir%"
if "%isCopy%"=="Y" if not "%MusicDir%"=="%Current_My_Music%" copyx "%Current_My_Music%\*" "%MusicDir%"
>nul 2>nul call :MusicIco %MusicDir%
>nul 2>nul attrib -r +a +s -h "%MusicDir%"
>nul 2>nul reg add "%regPath1%" /f /v "My Music" /t REG_SZ /d "%MusicDir%"
>nul 2>nul reg add "%regPath2%" /f /v "My Music" /t REG_EXPAND_SZ /d "%MusicDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{A0C69A99-21C8-4671-8703-7934162FCF1D}" /t REG_EXPAND_SZ /d "%MusicDir%"
if "%isDel%"=="Y" if not "%MusicDir%"=="%Current_My_Music%" echo.正在删除:"%Current_My_Music%" & rd /s /q "%Current_My_Music%">nul 2>nul::##########################『保存的游戏』##########################
echo 正在处理『保存的游戏』...
if not exist "%SavedGamesDir%" md "%SavedGamesDir%"
if "%isCopy%"=="Y" if not "%SavedGamesDir%"=="%Current_Saved_Games%" copyx "%Current_Saved_Games%\*" "%SavedGamesDir%"
>nul 2>nul call :SavedGamesIco %SavedGamesDir%
>nul 2>nul attrib -r +a +s -h "%SavedGamesDir%"
>nul 2>nul reg add "%regPath1%" /f /v "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}" /t REG_SZ /d "%SavedGamesDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}" /t REG_EXPAND_SZ /d "%SavedGamesDir%"
if "%isDel%"=="Y" if not "%SavedGamesDir%"=="%Current_Saved_Games%" echo.正在删除:"%Current_Saved_Games%" & rd /s /q "%Current_Saved_Games%">nul 2>nul::##########################『联系人』##########################
echo 正在处理『联系人』...
if not exist "%ContactsDir%" md "%ContactsDir%"
if "%isCopy%"=="Y" if not "%ContactsDir%"=="%Current_Contacts%" copyx "%Current_Contacts%\*" "%ContactsDir%"
>nul 2>nul call :ContactsIco %ContactsDir%
>nul 2>nul attrib -r +a +s -h "%ContactsDir%"
>nul 2>nul reg add "%regPath1%" /f /v "{56784854-C6CB-462B-8169-88E350ACB882}" /t REG_SZ /d "%ContactsDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{56784854-C6CB-462B-8169-88E350ACB882}" /t REG_EXPAND_SZ /d "%ContactsDir%"
if "%isDel%"=="Y" if not "%ContactsDir%"=="%Current_Contacts%" echo.正在删除:"%Current_Contacts%" & rd /s /q "%Current_Contacts%">nul 2>nul::##########################『链接』##########################
echo 正在处理『链接』...
if not exist "%LinksDir%" md "%LinksDir%"
if "%isCopy%"=="Y" if not "%LinksDir%"=="%Current_Links%" copyx "%Current_Links%\*" "%LinksDir%"
>nul 2>nul call :LinksIco %LinksDir%
>nul 2>nul attrib -r +a +s -h "%LinksDir%"
>nul 2>nul reg add "%regPath1%" /f /v "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}" /t REG_SZ /d "%LinksDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}" /t REG_EXPAND_SZ /d "%LinksDir%"
if "%isDel%"=="Y" if not "%LinksDir%"=="%Current_Links%" echo.正在删除:"%Current_Links%" & rd /s /q "%Current_Links%">nul 2>nul::##########################『搜索』##########################
echo 正在处理『搜索』...
if not exist "%SearchesDir%" md "%SearchesDir%"
if "%isCopy%"=="Y" if not "%SearchesDir%"=="%Current_Searches%" copyx "%Current_Searches%\*" "%SearchesDir%"
>nul 2>nul call :SearchesIco %SearchesDir%
>nul 2>nul attrib -r +a +s -h %SearchesDir%
>nul 2>nul reg add "%regPath1%" /f /v "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}" /t REG_SZ /d "%SearchesDir%"
>nul 2>nul reg add "%regPath2%" /f /v "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}" /t REG_EXPAND_SZ /d "%SearchesDir%"
if "%isDel%"=="Y" if not "%SearchesDir%"=="%Current_Searches%" echo.正在删除:"%Current_Searches%" & rd /s /q "%Current_Searches%">nul 2>nul::##########################『MediaPlayer』##########################
echo 正在处理『MediaPlayer』...
>nul 2>nul reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences" /f /v "TrackFoldersDirectories0" /t REG_SZ /d "%MusicDir%"
>nul 2>nul reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences" /f /v "TrackFoldersDirectories1" /t REG_SZ /d "%PicturesDir%"
>nul 2>nul reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences" /f /v "TrackFoldersDirectories2" /t REG_SZ /d "%VideosDir%"
>nul 2>nul reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences\HME\LastSharedFolders" /f /v "Folders0" /t REG_SZ /d "%MusicDir%"
>nul 2>nul reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences\HME\LastSharedFolders" /f /v "Folders1" /t REG_SZ /d "%PicturesDir%"
>nul 2>nul reg add "HKCU\Software\Microsoft\MediaPlayer\Preferences\HME\LastSharedFolders" /f /v "Folders2" /t REG_SZ /d "%VideosDir%"::##########################『图标缓存』##########################
echo 正在处理『图标缓存』...
>nul 2>nul attrib -r -a -s -h "%USERPROFILE%\Local Settings\Application Data\IconCache.db"
>nul 2>nul del /f /q "%USERPROFILE%\Local Settings\Application Data\IconCache.db"
taskkill /f /im explorer.exe
start explorer.exe
pause
goto :EOF:CreateRedReg
(
echo.Set oArgs = WScript.Arguments
echo.RegValue = CreateObject^("Wscript.Shell"^).RegRead^(oArgs^(0^)^)
echo.wscript.echo RegValue
)>"%cd%RedReg.vbs"
goto :EOF:PersonalIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21770echo IconResource=%%SystemRoot%%\system32\imageres.dll,-112echo IconFile=%%SystemRoot%%\system32\shell32.dllecho IconIndex=-235ter%%HP%\Documents\desktop.ini)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:DesktopIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21769echo IconResource=%%SystemRoot%%\system32\imageres.dll,-183)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:DownloadsIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21798echo IconResource=%%SystemRoot%%\system32\imageres.dll,-184)>"%*\desktop.ini"echo attrib -r +a +s +h "%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:FavoritesIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21796echo IconResource=%%SystemRoot%%\system32\imageres.dll,-115echo IconFile=%%SystemRoot%%\system32\shell32.dllecho IconIndex=-173)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:PicturesIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21779echo InfoTip=@%%SystemRoot%%\system32\shell32.dll,-12688echo IconResource=%%SystemRoot%%\system32\imageres.dll,-113echo IconFile=%%SystemRoot%%\system32\shell32.dllecho IconIndex=-236)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:VideosIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21791echo InfoTip=@%%SystemRoot%%\system32\shell32.dll,-12690echo IconResource=%%SystemRoot%%\system32\imageres.dll,-189echo IconFile=%%SystemRoot%%\system32\shell32.dllecho IconIndex=-238)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:MusicIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21790echo InfoTip=@%%SystemRoot%%\system32\shell32.dll,-12689echo IconResource=%%SystemRoot%%\system32\imageres.dll,-108echo IconFile=%%SystemRoot%%\system32\shell32.dllecho IconIndex=-237)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:SavedGamesIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21814echo IconResource=%%SystemRoot%%\system32\imageres.dll,-186)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:ContactsIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%CommonProgramFiles%%\system\wab32res.dll,-10100echo InfoTip=@%%CommonProgramFiles%%\system\wab32res.dll,-10200echo IconResource=%%SystemRoot%%\system32\imageres.dll,-181)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:LinksIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-21810echo IconResource=%%SystemRoot%%\system32\imageres.dll,-185echo DefaultDropEffect=^4echo [LocalizedFileNames]echo RecentPlaces.lnk=@shell32.dll,-37217echo Desktop.lnk=@shell32.dll,-21769echo Downloads.lnk=@shell32.dll,-21798)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF:SearchesIcodel "%*\desktop.ini"(echo [.ShellClassInfo]echo LocalizedResourceName=@%%SystemRoot%%\system32\shell32.dll,-9031echo IconResource=%%SystemRoot%%\system32\imageres.dll,-18echo [LocalizedFileNames]echo Indexed Locations.search-ms=@searchfolder.dll,-32820echo Everywhere.search-ms=@searchfolder.dll,-32822)>"%*\desktop.ini"attrib -r +a +s +h "%*\desktop.ini"
goto :EOF

下面是copyX.au3源码

au3代码是来自百度的某个文章

#NoTrayIcon#pragma compile(FileDescription, '简单调用Windows自带复制对话框复制文件或文件夹')
#pragma compile(FileVersion, 1.0.0.0)
#pragma compile(ProductName, Leo)
#pragma compile(ProductVersion, 1.0.0.0)
#pragma compile(LegalCopyright, Copyright ?  2020)
#pragma compile(x64, false)
#pragma compile(UPX, true)
#pragma compile(Compression, 9)
#pragma compile(Console, true)#include <APIShellExConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPIShellEx.au3>Global $bOverWrite = False, $bHelp = False
Global $srcPath = '', $dstPath = ''For $i = 1 To $CmdLine[0]If $CmdLine[$i] = '/y' Then$bOverWrite = TrueElseIf $CmdLine[$i] = '/?' Then$bHelp = TrueElseIf $srcPath = '' Then$srcPath = $CmdLine[$i]ElseIf $dstPath = '' Then$dstPath = $CmdLine[$i]EndIf
NextIf $bHelp Or $srcPath = '' Or $dstPath = '' ThenConsoleWrite("调用Windows自带的复制文件对话框来复制文件。" & @CRLF & @CRLF & _"CopyX [/Y] source destination" & @CRLF & @CRLF & @TAB & _"/Y             不提示直接覆盖目标文件。" & @CRLF & @TAB & _"source         指定要复制的文件。" & @CRLF & @TAB & _"destination    为新文件指定目录和/或文件名。" & @CRLF)Exit -1
EndIfIf FileExists($srcPath) <> 1 ThenConsoleWriteError('复制失败, 源文件不存在!')Exit -1
EndIfIf $bOverWrite Then_WinAPI_ShellFileOperation($srcPath, $dstPath, $FO_COPY, BitOR($FOF_NOCONFIRMATION, $FOF_NOCONFIRMMKDIR))Global $ret = @extended
Else_WinAPI_ShellFileOperation($srcPath, $dstPath, $FO_COPY, $FOF_SIMPLEPROGRESS)Global $ret = @extended
EndIfIf $ret <> 0 ThenConsoleWriteError("复制失败,错误代码: " & $ret & " 参考: https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_ShellFileOperation.htm")Exit $ret
ElseExit 0
EndIf

Windows用户目录迁移,库迁移,修复文件夹图标相关推荐

  1. Exchange 迁移 Public Folder 公共文件夹

    Exchange 迁移 Public Folder 公共文件夹 https://blog.51cto.com/horse87/1753800 今天给大家介绍一下公共文件夹的迁移操作步骤.正好我从Exc ...

  2. Win10使用cmd强行删除无法删除文件的艰辛历程[cmd中删除目录下子文件和子文件夹+修复文件夹所在磁盘+设置win10管理员模式]

    Win10无法删除文件 文章目录 Win10无法删除文件 问题 解决过程 1.cmd中删除文件夹内的文件和文件夹 2.修复文件夹所在磁盘 3.设置win10管理员模式 回到正题 引用 问题 最近ans ...

  3. Windows7 库 文件夹图标修改(转载)

    修改 Windows7 "库"文件夹默认图标 步骤如下: 1.准备好将要使用的图标 2.建立好对应的库的的文件夹后,打开到"X:\Users\<用户 名>\A ...

  4. Windows中现在有独立的Linux文件夹系统

    点击上方蓝色"程序猿DD",选择"设为星标" 回复"资源"获取独家整理的学习资料! 作者 | xplanet 来源 | 公众号「开源中国」 ...

  5. Windows如何自定义U盘盘符、文件夹图标、文件夹背景

    自定义U盘盘符.文件夹图标.文件夹背景 注意对于Vista和Win7的用户不支持文件夹图标和文件夹背景的更换 1.自定义盘符: 在U盘根目录下新建文件 autorun.inf(可先建.txt文本文档, ...

  6. Windows Internet Information Services(IIS) 与 inetpub 文件夹

    Windows 7+ 系统 自带了IIS 和 framework,不需要单独去下载,只需要开启后就可以运行程序. Windows 7 和 Windows 10 个别地方只是表述不一样,其效果相同,注意 ...

  7. 解决windows下无法创建以“.”开头的文件夹或者文件

    一.问题描述 在windows下创建以"."为开头的文件夹和文件,会出现下面问题: 二.问题解决 1.创建文件夹 比如创建.kaggle文件夹,这样显然是会失败的,所以你可以先随便 ...

  8. windows下如何删除需要***授权的文件夹、文件

    windows下如何删除需要*授权的文件夹.文件 首先,需要将你当前的登录用户设置为要被删除文件的拥有者. 假如要删除dvdMaker文件夹(注意这个文件夹需谨慎删除!!可能爆炸哦!) 提示需要*的权 ...

  9. 计算机受控文件夹管理,小技巧分享:如何在Windows 10中启用和使用受控文件夹访问!...

    勒索软件非常猖獗,除了安装防病毒软件外,您还需要格外小心以保护Windows计算机的安全.尽管人们始终可以使用一种反勒索软件,但Windows 10现在通过在Windows Defender安全中心中 ...

最新文章

  1. 学python有哪些书推荐-有哪些Python学习路线值得推荐?线路及书籍推荐都在这里...
  2. Java设计模式菜鸟系列(十三)建模和实现状态模式
  3. Groovy的春天从Java7诞生那日开始
  4. wpf中把按钮变成圆角
  5. 混合音乐推荐系统_比女朋友更懂你的“音乐推荐系统”,是怎样搭建出来的?...
  6. java类的理解_Java类该怎么理解?
  7. 宝可梦世界无限极可以玩服务器吗,口袋妖怪世界无极限运行库
  8. 解决win7检测不到第二个显示器的方法
  9. 【数据结构笔记02】什么是算法
  10. [Erlang 0020]网页游戏分线到不分线
  11. Loadrunner关联
  12. IDEA 2017 破解 license 激活
  13. 科技公司,请逃离一线城市
  14. 李智慧 - 架构师训练营 第三周
  15. 计算机原理课堂,计算机原理课堂测验题集.ppt
  16. Java经典300例-基础篇-004:整数类型最大值
  17. Java实验6 --模拟物流快递系统程序设计
  18. java web自动生成编号_2013-8-6 10:56:07 JAVA_WEB:员工号自动生成源代码
  19. IO系统性能之二:缓存和RAID如何提高磁盘IO性能
  20. 2021年智能晾衣机销售增长96%,好易点的增长引擎是什么?

热门文章

  1. Delphi常用批处理命令
  2. OPENCV3.4.1 +win7 64位+VS2017
  3. 烟台IT之家开通了!!
  4. 2 天! Google Cloud 2022 中国出海数字峰会进入倒计时!
  5. 怎样把mpg格式转成mp4
  6. 嵌入式文件系统FatFS和LittleFS对比
  7. Unresolved template reference
  8. Chrome浏览器控制台打开缓慢
  9. 快速了解常用的消息摘要算法,再也不用担心面试官的刨根问底
  10. 虚拟机Ubuntu18.04连不上网问题解决