[FUNC]SpecialFolder

55 篇文章 7 订阅
22 篇文章 0 订阅

AutoHotkey给定的内置特殊目录有限,为了扩充特殊目录,借用Wscript.Shell对象,或者借用FSO对象。

AutoHotkey脚本如下:

 

 

run  % SpecialFolder("Startup")
return

SpecialFolder(str="Desktop")
{
	WshShell:=ComObjCreate("Wscript.Shell")
	return  WshShell.SpecialFolders(str) 
}

 

 

上面的参考 http://www.jb51.net/article/15153.htm 

==============win32 API 如下===========================

/*
ShellSpecialFolderConstants enumeration
https://docs.microsoft.com/zh-cn/windows/win32/api/shldisp/ne-shldisp-shellspecialfolderconstants?redirectedfrom=MSDN

ssfDESKTOP	0x00 (0). Windows desktop—the virtual folder that is the root of the namespace.
ssfPROGRAMS	0x02 (2). File system directory that contains the user's program groups (which are also file system directories). A typical path is C:\Users<i>username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs.
ssfCONTROLS	0x03 (3). Virtual folder that contains icons for the Control Panel applications.
ssfPRINTERS	0x04 (4). Virtual folder that contains installed printers.
ssfPERSONAL	0x05 (5). File system directory that serves as a common repository for a user's documents. A typical path is C:\Users<i>username\Documents.
ssfFAVORITES	0x06 (6). File system directory that serves as a common repository for the user's favorite URLs. A typical path is C:\Documents and Settings<i>username\Favorites.
ssfSTARTUP	0x07 (7). File system directory that corresponds to the user's Startup program group. The system starts these programs whenever any user first logs into their profile after a reboot. A typical path is C:\Users<i>username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\StartUp.
ssfRECENT	0x08 (8). File system directory that contains the user's most recently used documents. A typical path is C:\Users<i>username\AppData\Roaming\Microsoft\Windows\Recent.
ssfSENDTO	0x09 (9). File system directory that contains Send To menu items. A typical path is C:\Users<i>username\AppData\Roaming\Microsoft\Windows\SendTo.
ssfBITBUCKET	0x0a (10). Virtual folder that contains the objects in the user's Recycle Bin.
ssfSTARTMENU	0x0b (11). File system directory that contains Start menu items. A typical path is C:\Users<i>username\AppData\Roaming\Microsoft\Windows\Start Menu.
ssfDESKTOPDIRECTORY	0x10 (16). File system directory used to physically store the file objects that are displayed on the desktop. It is not to be confused with the desktop folder itself, which is a virtual folder. A typical path is C:\Documents and Settings<i>username\Desktop.
ssfDRIVES	0x11 (17). My Computer—the virtual folder that contains everything on the local computer: storage devices, printers, and Control Panel. This folder can also contain mapped network drives.
ssfNETWORK	0x12 (18). Network Neighborhood—the virtual folder that represents the root of the network namespace hierarchy.
ssfNETHOOD	0x13 (19). A file system folder that contains any link objects in the My Network Places virtual folder. It is not the same as ssfNETWORK, which represents the network namespace root. A typical path is C:\Users<i>username\AppData\Roaming\Microsoft\Windows\Network Shortcuts.
ssfFONTS	0x14 (20). Virtual folder that contains installed fonts. A typical path is C:\Windows\Fonts.
ssfTEMPLATES	0x15 (21). File system directory that serves as a common repository for document templates.
ssfCOMMONSTARTMENU	0x16 (22). File system directory that contains the programs and folders that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu. Valid only for Windows NT systems.
ssfCOMMONPROGRAMS	0x17 (23). File system directory that contains the directories for the common program groups that appear on the Start menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs. Valid only for Windows NT systems.
ssfCOMMONSTARTUP	0x18 (24). File system directory that contains the programs that appear in the Startup folder for all users. A typical path is C:\Documents and Settings\All Users\Microsoft\Windows\Start Menu\Programs\StartUp. Valid only for Windows NT systems.
ssfCOMMONDESKTOPDIR	0x19 (25). File system directory that contains files and folders that appear on the desktop for all users. A typical path is C:\Documents and Settings\All Users\Desktop. Valid only for Windows NT systems.
ssfAPPDATA	0x1a (26). Version 4.71. File system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings<i>username\Application Data.
ssfPRINTHOOD	0x1b (27). File system directory that contains any link objects in the Printers virtual folder. A typical path is C:\Users<i>username\AppData\Roaming\Microsoft\Windows\Printer Shortcuts.
ssfLOCALAPPDATA	0x1c (28). Version 5.0. File system directory that serves as a data repository for local (non-roaming) applications. A typical path is C:\Users<i>username\AppData\Local.
ssfALTSTARTUP	0x1d (29). File system directory that corresponds to the user's non-localized Startup program group.
ssfCOMMONALTSTARTUP	0x1e (30). File system directory that corresponds to the non-localized Startup program group for all users. Valid only for Windows NT systems.
ssfCOMMONFAVORITES	0x1f (31). File system directory that serves as a common repository for the favorite URLs shared by all users. Valid only for Windows NT systems.
ssfINTERNETCACHE	0x20 (32). File system directory that serves as a common repository for temporary Internet files. A typical path is C:\Users<i>username\AppData\Local\Microsoft\Windows\Temporary Internet Files.
ssfCOOKIES	0x21 (33). File system directory that serves as a common repository for Internet cookies. A typical path is C:\Documents and Settings<i>username\Application Data\Microsoft\Windows\Cookies.
ssfHISTORY	0x22 (34). File system directory that serves as a common repository for Internet history items.
ssfCOMMONAPPDATA	0x23 (35). Version 5.0. Application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data.
ssfWINDOWS	0x24 (36). Version 5.0. Windows directory. This corresponds to the %windir% or %SystemRoot% environment variables. A typical path is C:\Windows.
ssfSYSTEM	0x25 (37). Version 5.0. The System folder. A typical path is C:\Windows\System32.
ssfPROGRAMFILES	0x26 (38). Version 5.0. Program Files folder. A typical path is C:\Program Files.
ssfMYPICTURES	0x27 (39). My Pictures folder. A typical path is C:\Users<i>username\Pictures.
ssfPROFILE	0x28 (40). Version 5.0. User's profile folder.
ssfSYSTEMx86	0x29 (41). Version 5.0. System folder. A typical path is C:\Windows\System32, or C:\Windows\Syswow32 on a 64-bit computer.
ssfPROGRAMFILESx86	0x30 (48). Version 6.0. Program Files folder. A typical path is C:\Program Files, or C:\Program Files (X86) on a 64-bit computer.
*/
sObj := ComObjCreate("Shell.Application")
sObj.Open( 0x12 ) ; ssfNETWORK           = 0x12
return

================================================================

.NET API 在这里 https://msdn.microsoft.com/en-us/library/system.environment.specialfolder(v=vs.110).aspx  ,但目前还不会直接用AutoHotkey调用

 

SpecialFolders属性一共有那些呢? 

AllUsersDesktop 
AllUsersStartMenu 
AllUsersPrograms 
AllUsersStartup 
Desktop 
Favorites 
Fonts 
MyDocuments 
NetHood 
PrintHood 
Programs 
Recent 
SendTo 
StartMenu 
Startup 
Templates 

 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值