下面是我日常使用的ahk脚本中的一部分.
可以很方便的在资源管理器中使用快捷键显示隐藏文件或者文件扩展名, 提高工作效率.
#SingleInstance force ;force a single instance
#HotkeyInterval 0 ;disable the warning dialog if a key is held down
#InstallKeybdHook ;Forces the unconditional installation of the keyboard hook
#MaxThreads 20 ;use 20 (the max) instead of 10 threads
;#NoTrayIcon
#NoEnv
SetBatchLines, -1 ;makes the script run at max speed
SetKeyDelay , -1, -1 ;faster response (might be better with -1, 0)
DetectHiddenText, On
DetectHiddenWindows, On ;detect hidden window
;;win7资源管理器的窗口类名, 如果是XP下, 需要修改
GroupAdd, Win7ShellClass, ahk_class WorkerW
GroupAdd, Win7ShellClass, ahk_class Progman
GroupAdd, Win7ShellClass, ahk_class CabinetWClass
GroupAdd, Win7ShellClass, ahk_class #32770
#IfWinActive,ahk_group Win7ShellClass
;;CTRL+Q显示隐藏系统文件
^Q::
RegRead,value,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\, Hidden
If(value=1)
value = 2
Else
value = 1
RegWrite, REG_DWORD, HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\, Hidden, %Value%
RegWrite, REG_DWORD, HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\, ShowSuperHidden, %Value%-1
PostMessage,0x111,0x7103,0,SHELLDLL_DefView1,A
return
;;CTRL+W显示文件扩展名
^W::
RegRead,Value,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\,HideFileExt
If(value=0)
value = 1
Else
value = 0
RegWrite, REG_DWORD,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\,HideFileExt, %Value%
PostMessage,0x111,0x7103,0,SHELLDLL_DefView1,A
return
#IfWinActive