AutoIt v3 绿色安装批处理
@echo offtitle AutoIt v3.3.14.2 Setup
if %PROCESSOR_ARCHITECTURE:~-2%==64 set regbit=/reg:64&set winbit=win64&set AutoItX3=AutoItX3_x64.dll
if %PROCESSOR_ARCHITECTURE:~-2%==86 set regbit= &set winbit=win32&set AutoItX3=AutoItX3.dll
:: Option
cls
echo.
echo Defaults for *.au3
echo.
echo What do you want to do when you double-click a *.au3 file?
echo.
echo.
echo Select a default option for *.au3 files.
echo.
echo * Run The script
echo.
echo Edit the script
echo.
echo Exit Setup
echo.
set /p option=Please enter a numeric option:
echo.
if "%option%"=="" set option=Run
if "%option%"=="1" set option=Run
if "%option%"=="2" set option=Edit
if "%option%"=="3" Exit
echo.
:: AutoItX3
reg add "HKLM\SOFTWARE\Classes\AppID\AutoItX3.DLL" /f /v "AppID" /t REG_SZ /d "{6E8109C4-F369-415D-AF9A-2AEEFF313234}"
reg add "HKLM\SOFTWARE\Classes\AppID\{6E8109C4-F369-415D-AF9A-2AEEFF313234}" /f /ve /t REG_SZ /d "AutoItX3"
reg add "HKLM\SOFTWARE\Classes\AutoItX3.Control" /f /ve /t REG_SZ /d "AutoItX3 Class"
reg add "HKLM\SOFTWARE\Classes\AutoItX3.Control.1" /f /ve /t REG_SZ /d "AutoItX3 Class"
reg add "HKLM\SOFTWARE\Classes\AutoItX3.Control.1\CLSID" /f /ve /t REG_SZ /d "{1A671297-FA74-4422-80FA-6C5D8CE4DE04}"
reg add "HKLM\SOFTWARE\Classes\AutoItX3.Control\CLSID" /f /ve /t REG_SZ /d "{1A671297-FA74-4422-80FA-6C5D8CE4DE04}"
reg add "HKLM\SOFTWARE\Classes\AutoItX3.Control\CurVer" /f /ve /t REG_SZ /d "AutoItX3.Control.1"
reg add "HKLM\SOFTWARE\Classes\CLSID\{1A671297-FA74-4422-80FA-6C5D8CE4DE04}" /f /v "AppID" /t REG_SZ /d "{6E8109C4-F369-415D-AF9A-2AEEFF313234}"
reg add "HKLM\SOFTWARE\Classes\CLSID\{1A671297-FA74-4422-80FA-6C5D8CE4DE04}" /f /ve /t REG_SZ /d "AutoItX3 Class"
reg add "HKLM\SOFTWARE\Classes\CLSID\{1A671297-FA74-4422-80FA-6C5D8CE4DE04}\InprocServer32" /f /v "ThreadingModel" /t REG_SZ /d "Apartment"
reg add "HKLM\SOFTWARE\Classes\CLSID\{1A671297-FA74-4422-80FA-6C5D8CE4DE04}\InprocServer32" /f /ve /t REG_SZ /d "%~dp0AutoItX\%AutoItX3%"
reg add "HKLM\SOFTWARE\Classes\CLSID\{1A671297-FA74-4422-80FA-6C5D8CE4DE04}\ProgID" /f /ve /t REG_SZ /d "AutoItX3.Control.1"
reg add "HKLM\SOFTWARE\Classes\CLSID\{1A671297-FA74-4422-80FA-6C5D8CE4DE04}\TypeLib" /f /ve /t REG_SZ /d "{F8937E53-D444-4E71-9275-35B64210CC3B}"
reg add "HKLM\SOFTWARE\Classes\CLSID\{1A671297-FA74-4422-80FA-6C5D8CE4DE04}\VersionIndependentProgID" /f /ve /t REG_SZ /d "AutoItX3.Control"
reg add "HKLM\SOFTWARE\Classes\CLSID\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}" /f /ve /t REG_SZ /d "PSFactoryBuffer"
reg add "HKLM\SOFTWARE\Classes\CLSID\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\InProcServer32" /f /v "ThreadingModel" /t REG_SZ /d "Both"
reg add "HKLM\SOFTWARE\Classes\CLSID\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\InProcServer32" /f /ve /t REG_SZ /d "%~dp0AutoItX\%AutoItX3%"
reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}" /f /ve /t REG_SZ /d "IAutoItX3"
reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\NumMethods" /f /ve /t REG_SZ /d "107"
reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\ProxyStubClsid32" /f /ve /t REG_SZ /d "{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}"
reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\TypeLib" /f /v "Version" /t REG_SZ /d "1.0"
reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\TypeLib" /f /ve /t REG_SZ /d "{F8937E53-D444-4E71-9275-35B64210CC3B}"
reg add "HKLM\SOFTWARE\Classes\TypeLib\{F8937E53-D444-4E71-9275-35B64210CC3B}\1.0" /f /ve /t REG_SZ /d "AutoItX3 1.0 Type Library"
reg add "HKLM\SOFTWARE\Classes\TypeLib\{F8937E53-D444-4E71-9275-35B64210CC3B}\1.0\0\%winbit%" /f /ve /t REG_SZ /d "%~dp0AutoItX\%AutoItX3%"
reg add "HKLM\SOFTWARE\Classes\TypeLib\{F8937E53-D444-4E71-9275-35B64210CC3B}\1.0\FLAGS" /f /ve /t REG_SZ /d "0"
reg add "HKLM\SOFTWARE\Classes\TypeLib\{F8937E53-D444-4E71-9275-35B64210CC3B}\1.0\HELPDIR" /f /ve /t REG_SZ /d "%~dp0AutoItX"
if %PROCESSOR_ARCHITECTURE:~-2%==64 reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}" /f /ve /t REG_SZ /d "IAutoItX3" %regbit%
if %PROCESSOR_ARCHITECTURE:~-2%==64 reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\ProxyStubClsid32" /f /ve /t REG_SZ /d "{00020424-0000-0000-C000-000000000046}" %regbit%
if %PROCESSOR_ARCHITECTURE:~-2%==64 reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\TypeLib" /f /v "Version" /t REG_SZ /d "1.0" %regbit%
if %PROCESSOR_ARCHITECTURE:~-2%==64 reg add "HKLM\SOFTWARE\Classes\Interface\{3D54C6B8-D283-40E0-8FAB-C97F05947EE8}\TypeLib" /f /ve /t REG_SZ /d "{F8937E53-D444-4E71-9275-35B64210CC3B}" %regbit%
:: Setup
reg add "HKLM\SOFTWARE\Classes\.a3x" /f /ve /t REG_SZ /d "AutoIt3XScript"
reg add "HKLM\SOFTWARE\Classes\.au3" /f /v "PerceivedType" /t REG_SZ /d "text"
reg add "HKLM\SOFTWARE\Classes\.au3" /f /ve /t REG_SZ /d "AutoIt3Script"
reg add "HKLM\SOFTWARE\Classes\.au3\PersistentHandler" /f /ve /t REG_SZ /d "{5e941d80-bf96-11cd-b579-08002b30bfeb}"
reg add "HKLM\SOFTWARE\Classes\.au3\ShellNew" /f /v "FileName" /t REG_SZ /d "Template.au3"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script" /f /ve /t REG_SZ /d "AutoIt v3 Script"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0Icons\au3script_v10.ico"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell" /f /ve /t REG_SZ /d "%option%"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\Compile" /f /ve /t REG_SZ /d "Compile Script"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\Compile\Command" /f /ve /t REG_SZ /d "\"%~dp0Aut2Exe\Aut2Exe_x64.exe\" /in \"%%l\""
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\CompileX64" /f /ve /t REG_SZ /d "Compile Script (x64)"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\CompileX64\Command" /f /ve /t REG_SZ /d "\"%~dp0Aut2Exe\Aut2Exe_x64.exe\" /in \"%%l\""
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\CompileX86" /f /ve /t REG_SZ /d "Compile Script (x86)"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\CompileX86\Command" /f /ve /t REG_SZ /d "\"%~dp0Aut2Exe\Aut2Exe.exe\" /in \"%%l\""
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\Edit" /f /ve /t REG_SZ /d "Edit Script"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\Edit\Command" /f /ve /t REG_SZ /d "\"%~dp0SciTE\SciTE.exe\" \"%%1\""
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\Open" /f /ve /t REG_SZ /d "Open"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\Open\Command" /f /ve /t REG_SZ /d "\"%~dp0SciTE\SciTE.exe\" \"%%1\""
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\Run" /f /ve /t REG_SZ /d "Run Script"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\Run\Command" /f /ve /t REG_SZ /d "\"%~dp0AutoIt3_x64.exe\" \"%%1\" %%*"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\RunX64" /f /ve /t REG_SZ /d "Run Script (x64)"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\RunX64\Command" /f /ve /t REG_SZ /d "\"%~dp0AutoIt3_x64.exe\" \"%%1\" %%*"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\RunX86" /f /ve /t REG_SZ /d "Run Script (x86)"
reg add "HKLM\SOFTWARE\Classes\AutoIt3Script\Shell\RunX86\Command" /f /ve /t REG_SZ /d "\"%~dp0AutoIt3.exe\" \"%%1\" %%*"
reg add "HKLM\SOFTWARE\Classes\AutoIt3XScript" /f /ve /t REG_SZ /d "AutoIt v3 Encoded Script"
reg add "HKLM\SOFTWARE\Classes\AutoIt3XScript\DefaultIcon" /f /ve /t REG_SZ /d "%~dp0Icons\au3script_v10.ico"
reg add "HKLM\SOFTWARE\Classes\AutoIt3XScript\Shell" /f /ve /t REG_SZ /d "Run"
reg add "HKLM\SOFTWARE\Classes\AutoIt3XScript\Shell\Run" /f /ve /t REG_SZ /d "Run Script"
reg add "HKLM\SOFTWARE\Classes\AutoIt3XScript\Shell\Run\Command" /f /ve /t REG_SZ /d "\"%~dp0AutoIt3_x64.exe\" \"%%1\" %%*"
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Au3Info.exe" /f /ve /t REG_SZ /d "%~dp0Au3Info.exe"
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Au3Info_x64.exe" /f /ve /t REG_SZ /d "%~dp0Au3Info_x64.exe"
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Aut2Exe.exe" /f /ve /t REG_SZ /d "%~dp0Aut2Exe\Aut2Exe.exe"
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Aut2Exe_x64.exe" /f /ve /t REG_SZ /d "%~dp0Aut2Exe\Aut2Exe_x64.exe"
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutoIt3.exe" /f /ve /t REG_SZ /d "%~dp0AutoIt3.exe"
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutoIt3_x64.exe" /f /ve /t REG_SZ /d "%~dp0AutoIt3_x64.exe"
reg add "HKLM\SOFTWARE\AutoIt v3\AutoIt" /f /v "InstallDir" /t REG_SZ /d "%~dp0" %regbit%
reg add "HKLM\SOFTWARE\AutoIt v3\AutoIt" /f /v "Version" /t REG_SZ /d "v3.3.14.2" %regbit%
for /f "delims= tokens=3" %%i in ('REG QUERY "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v "PSModulePath"^|findstr PSModulePath') do set old=%%i
echo %old%|find /i "AutoItX">nul
if %errorlevel%==1 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /f /v "PSModulePath" /t REG_EXPAND_SZ /d "%old%;%~dp0AutoItX"
reg add "HKCU\SOFTWARE\AutoIt v3\Aut2Exe" /f /v "AllowDecompile" /t REG_DWORD /d 1
reg add "HKCU\SOFTWARE\AutoIt v3\Aut2Exe" /f /v "LastCompression" /t REG_DWORD /d 2
reg add "HKCU\SOFTWARE\AutoIt v3\Aut2Exe" /f /v "LastExeDir" /t REG_SZ /d "My Documents"
reg add "HKCU\SOFTWARE\AutoIt v3\Aut2Exe" /f /v "LastIcon" /t REG_SZ /d ""
reg add "HKCU\SOFTWARE\AutoIt v3\Aut2Exe" /f /v "LastIconDir" /t REG_SZ /d "%~dp0Aut2Exe\Icons"
reg add "HKCU\SOFTWARE\AutoIt v3\Aut2Exe" /f /v "LastScriptDir" /t REG_SZ /d "My Documents"
:: Shortcut
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):a.Run(""cmd /c md "" & Chr(34) & a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Extras\AutoItX"" & Chr(34)):close")
if %PROCESSOR_ARCHITECTURE:~-2%==86 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersDesktop"") & ""\AutoIt Window Info.lnk""):b.TargetPath=""%~dp0Au3Info.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==86 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\AutoIt Window Info.lnk""):b.TargetPath=""%~dp0Au3Info.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==86 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Compile Script to .exe.lnk""):b.TargetPath=""%~dp0Aut2Exe\Aut2exe.exe"":b.WorkingDirectory=""%~dp0Aut2Exe"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==86 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Run Script.lnk""):b.TargetPath=""%~dp0AutoIt3.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==64 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersDesktop"") & ""\AutoIt Window Info (x64).lnk""):b.TargetPath=""%~dp0Au3Info_x64.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==64 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersDesktop"") & ""\AutoIt Window Info (x86).lnk""):b.TargetPath=""%~dp0Au3Info.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==64 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\AutoIt Window Info (x64).lnk""):b.TargetPath=""%~dp0Au3Info_x64.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==64 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\AutoIt Window Info (x86).lnk""):b.TargetPath=""%~dp0Au3Info.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==64 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Compile Script to .exe (x64).lnk""):b.TargetPath=""%~dp0Aut2Exe\Aut2exe_x64.exe"":b.WorkingDirectory=""%~dp0Aut2Exe"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==64 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Compile Script to .exe (x86).lnk""):b.TargetPath=""%~dp0Aut2Exe\Aut2exe.exe"":b.WorkingDirectory=""%~dp0Aut2Exe"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==64 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Run Script (x64).lnk""):b.TargetPath=""%~dp0AutoIt3_x64.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
if %PROCESSOR_ARCHITECTURE:~-2%==64 mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Run Script (x86).lnk""):b.TargetPath=""%~dp0AutoIt3.exe"":b.WorkingDirectory=""%~dp0"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\AutoIt Help File.lnk""):b.TargetPath=""%~dp0AutoIt.chm"":b.WorkingDirectory=""%~dp0"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Check For Updates.lnk""):b.TargetPath=""""""%~dp0AutoIt3.exe"""" """"%~dp0Extras\AutoUpdateIt\AutoUpdateIt.au3"""""":b.WorkingDirectory=""%~dp0SciTE"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Examples.lnk""):b.TargetPath=""%~dp0Examples"":b.WorkingDirectory=""%~dp0"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\SciTE Script Editor.lnk""):b.TargetPath=""%~dp0SciTE\SciTE.exe"":b.WorkingDirectory=""%~dp0SciTE"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Extras\AutoIt v3 Website.lnk.lnk""):b.TargetPath=""%~dp0AutoIt v3 Website.url"":b.WorkingDirectory=""%~dp0SciTE"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Extras\Browse Extras.lnk""):b.TargetPath=""%~dp0Extras"":b.WorkingDirectory=""%~dp0SciTE"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Extras\AutoItX\AutoItX Help File.lnk""):b.TargetPath=""%~dp0AutoItX\AutoItX.chm"":b.WorkingDirectory=""%~dp0AutoItX"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""AllUsersPrograms"") & ""\AutoIt v3\Extras\AutoItX\VBScript Examples.lnk""):b.TargetPath=""%~dp0AutoItX\Examples\VBScript"":b.WorkingDirectory=""%~dp0AutoItX"":b.Save:close")
代码 125 行生成的快捷方式有一点小错误,原因不明!
处理方法:修改 Check For Updates 的属性,删除目标中两个双引号间的空格再补回一个空格保存即可! 不错,谢谢分享!
页:
[1]