找回密码
 加入
搜索
查看: 5569|回复: 6

[原创] 更改xp桌面及我的文件路徑

  [复制链接]
发表于 2010-5-5 09:59:36 | 显示全部楼层 |阅读模式
本帖最后由 ragnada 于 2010-5-15 17:59 编辑

可以更改xp的桌面及我的最愛和我的文件到指定的磁碟中
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

;抓使用者ID給郵件用
ShellExecute("mail.vbs")
WinWait("Windows Script Host","ok")
ControlClick("Windows Script Host","ok","Button1")
$user_sid=IniRead("mail.ini","def","sid","查無此值")
$def_user_id=RegRead("HKEY_USERS"&$user_sid&"\Identities","Default User ID")

DirCreate("C:\Documents and Settings\Default User\mail")
Dircopy(".\mail","C:\Documents and Settings\Default User\mail",1)
FileCreateShortcut("%USERPROFILE%\mail\mail.exe","C:\Documents and Settings\Default User\「開始」功能表\程式集\啟動\mail.lnk","%USERPROFILE%\mail")
FileSetAttrib("C:\Documents and Settings\Default User\mail","+H")
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 298, 42, 193, 115)
$Label1 = GUICtrlCreateLabel("欲存放資料之硬碟", 8, 12, 164, 23)
GUICtrlSetFont(-1, 14, 400, 0, "華康儷粗圓")
$Combo1 = GUICtrlCreateCombo("C", 176, 8, 65, 25)
GUICtrlSetData(-1,"D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|原位置","D")
GUICtrlSetFont(-1, 14, 400, 0, "華康儷粗圓")
$Button1 = GUICtrlCreateButton("OK", 248, 8, 43, 25, 0)
GUIctrlSetOnEvent(-1,"butt")
GUICtrlSetFont(-1, 14, 400, 0, "華康儷粗圓")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
#EndRegion ### END Koda GUI section ###

while 1
        sleep(10)
WEnd


Func butt()
        if GUICtrlRead($Combo1)=="原位置" Then
                $rea=StringTrimRight(@DesktopDir,8)
                FileCopy(".\NTUSER\原位置\NTUSER.DAT","C:\Documents and Settings\Default User",1)
                MsgBox(0,"","位置已還原於Document and Setting")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Desktop","REG_EXPAND_SZ",@UserProfileDir&"\桌面")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Favorites","REG_EXPAND_SZ",@UserProfileDir&"\Favorites")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Personal","REG_EXPAND_SZ",@UserProfileDir&"\My Documents")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","My Pictures","REG_EXPAND_SZ",@UserProfileDir&"\My Documents\My Pictures")
                RegWrite("HKEY_USERS"&$user_sid&"\Identities"&$def_user_id&"\Software\Microsoft\Outlook Express\5.0","Store Root","REG_EXPAND_SZ",@UserProfileDir&"\我的郵件")
                IniWrite("C:\Documents and Settings\Default User\mail\mail.ini","def","DIR",@UserProfileDir)
                DirCopy($rea&"\桌面",@UserProfileDir, 1)
                DirCopy($rea&"\Favorites",@UserProfileDir, 1)
                DirCopy($rea&"\My Documents",@UserProfileDir, 1)
                run("shutdown -l")
                exit
        Else
                $dr=GUICtrlRead($Combo1)
                FileCopy(".\NTUSER"&$dr&"\NTUSER.DAT","C:\Documents and Settings\Default User",1)
                #cs
                DirCreate($dr&":\ghost")
                DirCopy(".\ghost",$dr&":\ghost",1)
                #ce
                MsgBox(0,"","存放於「"&$dr&":\使用者檔案\」")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Desktop","REG_EXPAND_SZ",$dr&":\使用者檔案\%USERNAME%\桌面")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Favorites","REG_EXPAND_SZ",$dr&":\使用者檔案\%USERNAME%\Favorites")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Personal","REG_EXPAND_SZ",$dr&":\使用者檔案\%USERNAME%\My Documents")
                RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","My Pictures","REG_EXPAND_SZ",$dr&":\使用者檔案\%USERNAME%\My Documents\My Pictures")
                RegWrite("HKEY_USERS"&$user_sid&"\Identities"&$def_user_id&"\Software\Microsoft\Outlook Express\5.0","Store Root","REG_EXPAND_SZ",$dr&":\使用者檔案\%USERNAME%\我的郵件")
                DirCreate($dr&":\使用者檔案"&@UserName)
                DirCopy(@UserProfileDir&"\桌面",$dr&":\使用者檔案"&@UserName&"", 1)
                DirCopy(@UserProfileDir&"\Favorites",$dr&":\使用者檔案"&@UserName&"", 1)
                DirCopy(@UserProfileDir&"\My Documents",$dr&":\使用者檔案"&@UserName&"", 1)
                FileSetAttrib($dr&":\使用者檔案","+H")
        ;~         FileSetAttrib($dr&":\ghost","+H")
                IniWrite("C:\Documents and Settings\Default User\mail\mail.ini","def","DIR",$dr)
                run("shutdown -l")
                exit
        EndIf
EndFunc

func SpecialEvents()
        Exit
EndFunc
之前的忘記把附屬的檔案一起包到 ,現在補上了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-5-5 12:35:14 | 显示全部楼层
谢谢分享,支持WIN7么
 楼主| 发表于 2010-5-5 15:48:23 | 显示全部楼层
本帖最后由 ragnada 于 2010-5-21 16:31 编辑

win7我還未實驗過,不過有寫了,xp和win7都是爾後新建使用都就會變成你所選擇的路徑
上次寫的lag會跑位,重新改過

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-5-10 08:59:13 | 显示全部楼层
来学一下方法了
发表于 2014-5-15 11:31:19 | 显示全部楼层
雷锋精神传天下!谢谢分享!
发表于 2015-4-24 16:20:55 | 显示全部楼层
谢谢分享,支持WIN7,回家慢慢研究
发表于 2015-4-25 10:45:11 | 显示全部楼层
学习一下,感谢感谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-22 15:30 , Processed in 0.081494 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表