[AHK]从注册表获取特殊路径

来源:互联网 发布:erp金蝶软件 编辑:程序博客网 时间:2024/05/21 13:27


/*;作者:QQ1576157;时间:2017年1月7日21:10:39; 功能: 从注册表获取特殊路径,此方法以支持以下特殊路径,AutoHotkey虽然支持一些特殊路径但还是不全。;原理:遍历HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders;可获得路径包括以下特殊位置CD BurningPrintHood{374DE290-123F-4565-9164-39C4925E467B}TemplatesStart MenuStartupSendToRecentProgramsPersonalNetHoodMy VideoMy PicturesMy MusicLocal AppDataHistoryFavoritesDesktopCookiesCacheAppData*/dir:=getSpec("Desktop");~ dir:=getSpec("My Video")if InStr(FileExist(dir), "D")Run %dir%;~ Run,%ComSpec%, %dir%elseMsgBox 出错returngetSpec(str){Loop, Reg, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders, KVR{ if a_LoopRegType = keyvalue =else{RegRead, valueif ErrorLevelvalue = *error*};~ MsgBox, 4, , %a_LoopRegName% = %value% (%a_LoopRegType%)`n`nContinue?;~ IfMsgBox, NO, breakif (a_LoopRegName=str)  ;桌面在注册表中为Desktop,注意加上引号break};~ dir:=ParseCmdLine(value);~ StringTrimRight,UserProfileDir, A_AppData, 16 ;~ StringReplace, dir, value, `%USERPROFILE`%, % UserProfileDir, AllTransform,dir,Deref,%value%return dir}

参考:

 实现当前目录下开启CMD - N3verL4nd - 博客园 http://www.cnblogs.com/lgh1992314/p/5834693.html

得到win7 win8的桌面句柄 - whatday的专栏 - 博客频道 - CSDN.NET http://blog.csdn.net/whatday/article/details/8714573


0 0
原创粉丝点击