AutoHotkey右键菜单汉化/一键更新最新版本

复制保存为bat文件,文件编码设置为ANSI,可以一键检测ahk注册表并更新ahk版本、汉化右键菜单

win10的cmd因为内置了curl可以在线更新检测。win7只能汉化操作。如果电脑上没装ahk,运行此脚本会自动下载并静默安装AutoHotkey

AutoHotkey右键菜单汉化/一键更新最新版本

@echo off&PUSHD %~DP0
title AutoHotkey右键菜单汉化工具箱Win10+版 1.8 by冥想
color 0b
chcp 936 >nul
rem AutoHotkey交流群【蜜獾哥】编写
rem 如果检测到设备未安装AutoHotkey脚本会自动下载v1版到系统桌面并静默安装。更多功能请自行扩展...
::【&&】 连接两个命令,当&&前的命令成功时,才执行&&后的命令。   
::【||】 连接两个命令,当||前的命令失败时,才执行||后的命令。
::自动下载需要借助curl指令,低版本系统可能缺少组件,请在https://curl.se/download.html下载并添加环境变量
Rd "%WinDir%\system32\test_permissions" >NUL 2>NUL
Md "%WinDir%\System32\test_permissions" 2>NUL||(goto not_admin)
Rd "%WinDir%\System32\test_permissions" 2>NUL
goto :as_admin
rem 检查脚本是否以管理员身份运行WIn10+有效,win7可能无效!
rem net.exe session 1>NUL 2>NUL && (
rem    goto as_admin
rem ) || (
rem    goto not_admin
rem )

rem ****************************************************************************
:: 非管理员模式,强制重启脚本
:not_admin
	echo ******************************************************************
	echo      当前非管理员权限,正在强制重启脚本获取权限请稍候...
	echo ******************************************************************
	echo *            ####              ###         ###    ###       ###  *
	echo *           ######             ###         ###    ###      ###   *
	echo *          ###  ###            ###         ###    ###     ###    *
	echo *         ###    ###           ###         ###    ###    ###     *
	echo *        ###      ###          ###         ###    ###   ###      *
	echo *       ##############         ###############    ########       *
	echo *      ###          ###        ###         ###    ###   ###      *
	echo *     ###            ###       ###         ###    ###    ###     *
	echo *    ###              ###      ###         ###    ###     ###    *
	echo *   ###                ###     ###         ###    ###      ###   *
	echo *  ###                  ###    ###         ###    ###       ###  *
	echo ******************************************************************
	echo   如设备检测到未装AHK会自动下载并安装,需写入注册表出现拦截请允许!
	echo ******************************************************************
	%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
	cd /d "%~dp0"

rem ****************************************************************************
:: 管理员权限运行模式
:as_admin
	rem 检测curl下载组件是否存在
	curl -V>nul 2>nul&& set "curlVar=load" || set "curlVar="
	rem 注册表判断是电脑上是否安装AutoHotkey, 安装过继续反之退出!
	reg query "HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey" /v InstallDir>nul 2>nul&&goto loadahkRegParameter||goto downloadahkinstallpackage

:Load-the-ahk-definition-window
	rem 载入注册表参数
	echo ****************************************************
	echo   当前设备已安装AutoHotkey v%ahkVersion%
	echo   安装路径:%ahkInstallDir%
	echo ****************************************************
	echo   0、预设内置默认的汉化模板
	echo   1、右键菜单【open】项关键字:"%ahkOpenName%"
	echo   2、右键菜单【open】项图标路径:%ahkOpenIcon%
	echo   ----------------------------------------------------
	echo   3、右键菜单【edit】项关键字:"%ahkEditName%"
	echo   4、右键菜单【edit】项图标路径:%ahkEditIcon%
	echo   5、右键菜单【edit】项编辑器路径:%ahkEditIDEPath%
	echo   ----------------------------------------------------
	echo   6、右键菜单【Compile】项关键字:"%ahkCompileName%"
	echo   7、右键菜单【Compile】项图标路径:%ahkCompileIcon%
	echo   ----------------------------------------------------
	echo   8、右键菜单【Compile-Gui】项关键字:"%ahkCompileGuiName%"
	echo   9、右键菜单【Compile-Gui】项图标路径:%ahkCompileGuiIcon%
	echo   ----------------------------------------------------
	echo   10、右键菜单【uiAccess】项关键字:"%ahkuiAccessName%"
	echo   11、右键菜单【uiAccess】项图标路径:"%ahkuiAccessIcon%"
	echo   --------------------------------------------------
	echo   12、AutoHotkey版本检查更新
	echo   --------------------------------------------------
	echo   输入编号进行修改或定义Enter键执行,输入ok回车修改!
	echo ****************************************************
	if defined defaultTemplate (
		echo   当前为预设默认汉化模板,输入ok回车修改!
		echo ****************************************************
		set defaultTemplate=
	)

	set /p keywords=请输入编号,Enter键执行修改:
	if "%keywords%"=="1" (
		call :Loadinputbox 【open项名称】
	) else if "%keywords%"=="2" (
		echo 正在选择open项图标文件,请稍候...
		call :FileSelectFile 【open项图标路径】
	) else if "%keywords%"=="3" (
		call :Loadinputbox 【Edit项名称】
	) else if "%keywords%"=="4" (
		echo 正在选择Edit项图标文件,请稍候...
		call :FileSelectFile 【Edit项图标路径】
	) else if "%keywords%"=="5" (
		echo 正在选择Edit项编辑器路径文件,请稍候...
		call :FileSelectFile 【Edit项编辑器路径】
	) else if "%keywords%"=="6" (
		call :Loadinputbox 【Compile项名称】
	) else if "%keywords%"=="7" (
		echo 正在选择Compile项图标文件,请稍候...
		call :FileSelectFile  【Compile项图标路径】
	) else if "%keywords%"=="8" (
		call :Loadinputbox 【Compile-Gui项名称】
	) else if "%keywords%"=="9" (
		echo 正在选择Compile-Gui项图标文件,请稍候...
		call :FileSelectFile  【Compile-Gui项图标路径】
	) else if "%keywords%"=="10" (
		call :Loadinputbox 【uiAccess项名称】
	) else if "%keywords%"=="11" (
		echo 正在选择uiAccess项图标文件,请稍候...
		call :FileSelectFile  【uiAccess项图标路径】
	) else if "%keywords%"=="12" (
		rem 检测curl下载组件是否存在
		echo ····················································
		echo 检查更新中请稍候...
		curl -V>nul 2>nul&& set "curlVar=load" || set "curlVar="
		set "ahkVersion=%ahkVersion: =%"
		setlocal ENABLEDELAYEDEXPANSION
		if defined curlVar (
			curl --retry 3 --connect-time 6  --max-time 8 -# -f "https://www.autohotkey.com/download/1.1/version.txt" |findstr  "1.1" >nul && (
				for /f %%a in ('curl -# -f "https://www.autohotkey.com/download/1.1/version.txt"') do ( set "lastAhkVersion=%%a" )
				set lastAhkVersion=!lastAhkVersion!
			)
		)
		if defined lastAhkVersion (
			if "!ahkVersion!" LSS "!lastAhkVersion!" (
				endlocal
				call :downloadahkinstallpackage
			) else (
				endlocal
				echo 当前v%ahkVersion%已是最新版本无需更新!&echo.
			)
		) else (
			endlocal
			echo AutoHotkey版本检查失败!&TIMEOUT /t 10
			cls&goto :Load-the-ahk-definition-window
		)
	) else if "%keywords%"=="0" (
		rem 预设默认模板
		set "ahkOpenName=运行(&O)"
		set "ahkEditName=编辑(&E)"
		set "ahkCompileName=编译"
		set "ahkCompileGuiName=编译<GUI>"
		set "ahkuiAccessName=以UIAccess权限运行"
		if exist "%UIAEXEPATH%" (
			set "ahkuiAccessIcon=%UIAEXEPATH%"
		) else (
			set "ahkuiAccessIcon=%ahkOpenIcon%"
		)
		set "defaultTemplate=ok"&cls
		goto :Load-the-ahk-definition-window
	) else if "%keywords%"=="ok" (
		goto :Submit-all-results
	) else if "%keywords%"=="OK" (
		goto :Submit-all-results
	) else if "%keywords%"=="oK" (
		goto :Submit-all-results
	) else if "%keywords%"=="Ok" (
		goto :Submit-all-results
	) else (
		cls&goto :Load-the-ahk-definition-window
	)
	pause
	goto :onexist

:Loadinputbox
	set /p "RegValue=请输入%1自定义字符,Enter键执行修改:"
	if defined RegValue (
		echo "%1"| findstr /i "open项" >nul && (
			set "ahkOpenName=%RegValue%(&O)"
		)
		echo "%1"| findstr /i "edit项" >nul && (
			set "ahkEditName=%RegValue%(&E)"
		)
		echo "%1"| findstr /i "Compile项" >nul && (
			set "ahkCompileName=%RegValue%"
		)
		echo "%1"| findstr /i "Compile-Gui项" >nul && (
			set "ahkCompileGuiName=%RegValue%"
		)
		echo "%1"| findstr /i "uiAccess项" >nul && (
			set "ahkuiAccessName=%RegValue%"
		)		
	)
	cls
	goto :Load-the-ahk-definition-window

rem 提交写与入注册表
:Submit-all-results
	rem 格式化变量以统一去掉引号,写注册表时再加上
	Set "ahkOpenName=%ahkOpenName:"=%"
	Set "ahkOpenIcon=%ahkOpenIcon:"=%"
	Set "ahkEditName=%ahkEditName:"=%"
	Set "ahkEditIDEPath=%ahkEditIDEPath:"=%"
	Set "ahkEditIcon=%ahkEditIcon:"=%"
	Set "ahkCompileName=%ahkCompileName:"=%"
	Set "ahkCompileIcon=%ahkCompileIcon:"=%"
	Set "ahkCompileGuiName=%ahkCompileGuiName:"=%"
	Set "ahkCompileGuiIcon=%ahkCompileGuiIcon:"=%"
	Set "ahkuiAccessName=%ahkuiAccessName:"=%"
	Set "ahkuiAccessIcon=%ahkuiAccessIcon:"=%"
	rem 右键菜单【Run Script】项
	
	reg query "HKEY_CLASSES_ROOT\AutoHotkeyScript" /ve >nul 2>nul&& (
		echo 正在写入注册表,如果出现拦截请允许...
	) || (
		echo 正在写入注册表,如果出现拦截请允许...
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript"
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell"

	)
	if defined ahkOpenName (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open" /ve /t REG_SZ /d "%ahkOpenName%" /f
	)
	if defined ahkOpenIcon (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open" /v Icon /t REG_SZ /d "%ahkOpenIcon%" /f
	)
	rem 右键菜单【Edit Script】项
	if defined ahkEditName (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit" /ve /t REG_SZ /d "%ahkEditName%" /f
	)
	if defined ahkEditIcon (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit" /v Icon /t REG_SZ /d "%ahkEditIcon%" /f
	)
	if defined ahkEditIDEPath (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command" /ve /t REG_SZ /d "%ahkEditIDEPath%" /f
	)
	rem 右键菜单【Compile Script】项
	if defined ahkCompileName (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile" /ve /t REG_SZ /d "%ahkCompileName%" /f
	)
	if defined ahkCompileIcon (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile" /v Icon /t REG_SZ /d "%ahkCompileIcon%" /f
	)
	rem 右键菜单【Compile Script (GUI)...】项
	if defined ahkCompileGuiName (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile-Gui" /ve /t REG_SZ /d "%ahkCompileGuiName%" /f
	)
	if defined ahkCompileGuiIcon (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile-Gui" /v Icon /t REG_SZ /d "%ahkCompileGuiIcon%" /f
	)
	rem 右键菜单【Run with UI Access】项
	if defined ahkuiAccessName (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\uiAccess" /ve /t REG_SZ /d "%ahkuiAccessName%" /f
	)
	if defined ahkuiAccessIcon (
		reg add "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\uiAccess" /v Icon /t REG_SZ /d "%ahkuiAccessIcon%" /f
	)

	reg query "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\uiAccess\Command" /ve >nul 2>nul&& (
		echo ****************************************************
		echo 菜单项汉化修改完成!
	) || (
		echo ****************************************************
		echo 菜单项汉化修改完成!
		echo y|reg copy "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open\Command" "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\uiAccess\Command" /s /f
	)
	TIMEOUT /t 10
	cls&goto :Load-the-ahk-definition-window


rem 安装路径 REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey" /v "InstallDir"
rem	模板路径 REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.ahk\ShellNew" /v "FileName"
rem	版本号 REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey" /v "Version"
rem	默认图标 HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\DefaultIcon
rem	右键菜单【编译】 HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile
rem	右键菜单【编译】HKEY_CLASSES_ROOT\AutoHotkeyScript\DefaultIcon
rem	右键菜单【编辑】HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit
rem	右键菜单【编译Gui】HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile-Gui
rem	右键菜单【Run with UI Access】HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\uiAccess
rem	HKEY_CLASSES_ROOT\AutoHotkeyScript\DefaultIcon

:loadahkRegParameter
	::获取UACIsEnabled状态
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ^| find /i "EnableLUA"') do set "ahkUACIsEnabled=%%k"
	::获取安装目录
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey" ^| find /i "InstallDir"') do set "ahkInstallDir=%%k"
	::获取ahk版本信息
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey" ^| find /i "Version"') do set "ahkVersion=%%k"

	::获取ahk系统菜单右键为open项
	rem echo "%%k"| findstr "REG_SZ" >nul && (...)
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open" ^| find /i "(默认)"') do set "ahkOpenName=%%k"
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Open" ^| find /i "Icon"') do set "ahkOpenIcon=%%k"

	::获取ahk系统菜单右键为edit项
	rem echo "%%k"| findstr "REG_SZ" >nul && (...)
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\edit" ^| find /i "(默认)"') do set "ahkeditName=%%k"
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\edit" ^| find /i "Icon"') do set "ahkEditIcon=%%k"
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command" ^| find /i "(默认)"') do set "ahkEditIDEPath=%%k"
	
	::获取ahk系统菜单右键为Compile项
	rem echo "%%k"| findstr "REG_SZ" >nul && (...)
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile" ^| find /i "(默认)"') do set "ahkCompileName=%%k"
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile" ^| find /i "Icon"') do set "ahkCompileIcon=%%k"
	
	::获取ahk系统菜单右键为Compile-Gui项
	rem echo "%%k"| findstr "REG_SZ" >nul && (...)
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile-Gui" ^| find /i "(默认)"') do set "ahkCompileGuiName=%%k"
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile-Gui" ^| find /i "Icon"') do set "ahkCompileGuiIcon=%%k"
	
	::获取ahk系统菜单右键为uiAccess项
	rem echo "%%k"| findstr "REG_SZ" >nul && (...)
	reg query "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\uiAccess" /v Icon>nul 2>nul&& (
		for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\uiAccess" ^| find /i "(默认)"') do set "ahkuiAccessName=%%k"
		for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\uiAccess" ^| find /i "Icon"') do set "ahkuiAccessIcon=%%k"
	)
	set OSBit=%PROCESSOR_ARCHITECTURE:~-2%
	if "%OSBit%"=="86" (
		set "UIAEXEPATH=%ahkInstallDir%\AutoHotkeyU32_UIA.exe"
	) else (
		set "UIAEXEPATH=%ahkInstallDir%\AutoHotkeyU64_UIA.exe"
	)
	if exist "%ahkInstallDir%" (
		if defined ahkOpenName (
			set "ahkOpenName=%ahkOpenName:""="%"
		)
		if defined ahkEditName (
			set "ahkEditName=%ahkEditName:""="%"
		)
		if defined ahkEditIDEPath (
			set "ahkEditIDEPath=%ahkEditIDEPath:""="%"
		) else (
			set "ahkEditIDEPath="%WinDir%\Notepad.exe^" ^"%%1^""
		)
		if defined ahkCompileName (
			set "ahkCompileName=%ahkCompileName:""="%"
		)
		if defined ahkCompileGuiName (
			set "ahkCompileGuiName=%ahkCompileGuiName:""="%"
		)
		if defined ahkuiAccessName (
			set "ahkuiAccessName=%ahkuiAccessName:""="%"
		)
		if defined ahkOpenIcon (
			set "ahkOpenIcon=%ahkOpenIcon:"=%"
		) else (
			set "ahkOpenIcon=%ahkInstallDir%\AutoHotkey.exe"
		)
		if defined ahkEditIcon (
			set "ahkEditIcon=%ahkEditIcon:"=%"
		) else (
			set "ahkEditIcon=%windir%\notepad.exe"
		)
		if defined ahkCompileIcon (
			set "ahkCompileIcon=%ahkCompileIcon:"=%"
		) else (
			set "ahkCompileIcon=%ahkInstallDir%\Compiler\Ahk2Exe.exe"
		)
		if defined ahkCompileGuiIcon (
			set "ahkCompileGuiIcon=%ahkCompileGuiIcon:"=%"
		) else (
			set "ahkCompileGuiIcon=%ahkInstallDir%\Compiler\Ahk2Exe.exe"
		)
		if defined ahkuiAccessIcon (
			if exist "%UIAEXEPATH%" (
				set "ahkuiAccessIcon=%UIAEXEPATH%"
			) else (
				set "ahkuiAccessIcon=%ahkInstallDir%\AutoHotkey.exe"
			)
		) else (
			if exist "%UIAEXEPATH%" (
				set "ahkuiAccessIcon=%UIAEXEPATH%"
			) else (
				set "ahkuiAccessIcon=%ahkInstallDir%\AutoHotkey.exe"
			)
		)
		
		rem 预设默认模板
		if not defined ahkOpenName (
			set "ahkOpenName=运行(&O)"
		)
		if not defined ahkEditName (
			set "ahkEditName=编辑(&E)"
		)
		if not defined ahkEditIDEPath (
			set "ahkEditIDEPath="%WinDir%\Notepad.exe^" ^"%%1^""
		)
		if not defined ahkCompileName (
			set "ahkCompileName=编译"
		)
		if not defined ahkCompileGuiName (
			set "ahkCompileGuiName=编译<GUI>"
		)
		if not defined ahkuiAccessName (
			set "ahkuiAccessName=以UIAccess权限运行"
		)
		if not defined ahkuiAccessIcon (
			if exist "%UIAEXEPATH%" (
				set "ahkuiAccessIcon=%UIAEXEPATH%"
			) else (
				set "ahkuiAccessIcon=%ahkOpenIcon:"=%"
			)
		)
		goto :Load-the-ahk-definition-window
	) else (
		goto :downloadahkinstallpackage
	)

rem 下载AutoHotkey安装包并默认安装
:downloadahkinstallpackage
	echo ····················································
	:: 获取系统桌面路径以保存信息到本地
	for /f "tokens=1,2,* " %%i in ('REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "desktop" ^| findstr /i /C:"REG_SZ"') do set "desktoppath=%%k"
	:: 格式化桌面路径
	set "desktoppath=%desktoppath:\\=\%"

	rem 检测curl下载组件是否存在
	curl -V>nul 2>nul&& set "curlVar=load" || set "curlVar="
	if not defined curlVar (
		goto :onError
	) else (
		if exist "%desktoppath%\ahk-install.exe" (
			del /F/Q %desktoppath%\ahk-install.exe
		)
		setlocal ENABLEDELAYEDEXPANSION
		echo 正在检测curl组件中请稍候...
		curl --retry 2 --connect-time 5  --max-time 4 -# -f "https://www.autohotkey.com/download/1.1/version.txt" |find  "1.1" >nul && (
			for /f %%a in ('curl --retry 2 --connect-time 5  --max-time 4 -# -s "https://www.autohotkey.com/download/1.1/version.txt"') do set "lastAhkVersion=%%a"
		)
		if defined lastAhkVersion (
			echo ····················································
			echo autohotkey发现最新版本v!lastAhkVersion!
			set "ahkLoadUrl=https://www.autohotkey.com/download/ahk-install.exe"
			echo ····················································
			echo AutoHotkey!lastAhkVersion!安装包正在下载中请稍候...
			echo ····················································
			rem --progress-bar
			curl "!ahkLoadUrl!" -f -# -o "!desktoppath!\ahk-install.exe"
		)
		endlocal
		echo ····················································
		if exist "%desktoppath%\ahk-install.exe" (
			echo AutoHotkey安装包静默安装中请稍候...
			if defined ahkInstallDir (
				start /wait /high "" "%desktoppath%\ahk-install.exe" /S /R /uiAccess /D=%ahkInstallDir%
			) else (
				start /wait /high "" "%desktoppath%\ahk-install.exe" /S /R /uiAccess
			)
			reg query "HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey" /v InstallDir>nul 2>nul&& ( cls&goto loadahkRegParameter ) || ( goto :onDownLoadError )
		) else (
			echo autohotkey安装包下载失败!&TIMEOUT /t 10&cls&goto loadahkRegParameter
		)
		if exist "%desktoppath%\ahk-install.exe" (
			del /F/Q %desktoppath%\ahk-install.exe
		)
	)

:onDownLoadError
	echo 下载出现未知错误无法安装,请手动操作...
	echo ····················································
	echo 即将跳转https://www.autohotkey.com/download/ahk-install.exe下载页面
	echo ····················································
	start https://www.autohotkey.com/download/ahk-install.exe
	TIMEOUT /t 10
	goto :onexist

:onError
	echo 你的系统缺少curl组件故CMD无法提供下载请稍候再试...
	echo ····················································
	echo 即将跳转https://curl.se/download.html下载页面
	echo ····················································
	start https://curl.se/download.html
	TIMEOUT /t 10
	goto :onexist
	
	
:onexist
	exit

:FileSelectFile
	echo 正在选择%1目标文件,请稍候...
	set dialog="about:<input type=file id=FILE><script>FILE.click();new ActiveXObject
	set dialog=%dialog%('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);
	set dialog=%dialog%close();resizeTo(0,0);</script>"
	for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "selectedfile=%%p"
	if exist "%selectedfile%" (
		echo "%1"| findstr /i "open项" >nul && (
			set "ahkOpenIcon=%selectedfile%"
		)
		echo "%1"| findstr /i "edit项图标" >nul && (
			set "ahkEditIcon=%selectedfile%"
		)
		echo "%1"| findstr /i "edit项编辑器" >nul && (
			set "ahkEditIDEPath="%selectedfile%^" ^"%%1^""
		)
		echo "%1"| findstr /i "Compile项" >nul && (
			set "ahkCompileIcon=%selectedfile%"
		)
		echo "%1"| findstr /i "Compile-Gui项" >nul && (
			set "ahkCompileGuiIcon=%selectedfile%"
		)
		echo "%1"| findstr /i "uiAccess项" >nul && (
			set "ahkuiAccessIcon=%selectedfile%"
		)	
	) else (
		echo 选择已取消!
	)
	cls
	goto :Load-the-ahk-definition-window

ahk-bat检测/汉化脚本下载

提取码:84bs复制
解压码:无
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA捐赠
共{{data.count}}人
人已捐赠
其他

VirtualDesktop虚拟桌面管理类

2022-12-11 22:16:22

其他函数

设置互斥体,阻止脚本重复运行

2022-12-12 14:57:59

5 条回复 A文章作者 M管理员
  1. oeasy

    老表又帅到了新高度

  2. dbgba
    dbgba给您捐赠了¥2
  3. aahk

    比较高级 建议,自动静默下载并安装: 1、AutoHotkey最新版本, 2、SciTE4AutoHotkey最新版本, 3、注册简体中文鼠标右键菜单, 4、关联AHK文件类型, 5、常用脚本实例源代码。 好评,点赞,确实是很强大的脚本

  4. aahk

    为什么批处理脚本会如此高级呢? 我比较喜欢 批处理、AHK、Delphi 等单个exe可执行文件的工具软件,绿色,便携,易用。

  5. aahk

    REM /* REM ============================================================= REM 一键打包成exe.bat REM ============================================================= REM */ if exist “C:Program Files (x86)WinRARWinRAR.exe” ( “C:Program Files (x86)WinRARWinRAR.exe” a -ag_YYYY.MM.DD -iiconico.ico -m5 -r -sfx -z自解压脚本命令.txt SS-AutoHotkey.exe ..*.* )else ( “C:Program FilesWinRARWinRAR.exe” a -ag_YYYY.MM.DD -iiconico.ico -m5 -r -sfx -z自解压脚本命令.txt SS-AutoHotkey.exe ..*.* ) REM /* REM ============================================================= REM Silent_Setup_AHK.bat – 全自动静默安装并设置AutoHotkey和SciTE4AutoHotkey的批处理脚本 REM ============================================================= REM */ START “” “%~dp0″AutoHotkey_1.1.34.04_setup.exe /S /A32 /U32 /U64 /D=D:ProgAutoHotkey /WAIT REM 等待3秒钟,以便让AHK文件关联生效,使ahk脚本能够顺利运行 REM ping -n 3 127.0.0.1>nul 2>nul REM 设置AHK文件关联、汉化AHK文件右键菜单(运行脚本、编译脚本、编译脚本(GUI)、编辑脚本) REM 脚本说明: 此工具用来修改 AutoHotkey 脚本的右键菜单关联,适用于 AutoHotkey 安装版、绿色版。 REM 作者: 甲壳虫 REM 修改作者: 兔子 START “” “%~dp0″SciTE_Linked.exe EXIT

个人中心
购物车
优惠劵
有新私信 私信列表
搜索