Code: Select all
IfExistThenRun(myPath) {
IfExist, %myPath%
Run, %myPath%
}
; This is not good enough, expand this to look in multiple locations, maybe up to 4 arguments, test each in order until get a hit then use that to open.
; Also, possibly should open existing app if already open? e.g. if existing app is found to be open, just ask "Open new instance, or use existing instance?" if so.
:x*:xxpowershell::
:x*:xxps::Run, powershell.exe
:x*:xxpw:: ; "pw" short for "pwsh"
:x*:xxp7::IfExistThenRun("C:\Program Files\PowerShell\7\pwsh.exe")
:x*:xxp6::IfExistThenRun("C:\Program Files\PowerShell\6\pwsh.exe")
:x*:xxp8::IfExistThenRun("C:\Program Files\PowerShell\8\pwsh.exe") ; pw should open latest available!
:x*:xxcmd::Run, cmd.exe
:x*:xxcalc::Run, calc.exe
:x*:xxsp::IfExistThenRun("C:\Program Files (x86)\SpeedCrunch\speedcrunch.exe")
:x*:xxword::Run, winword.exe
:x*:xxexcel::Run, excel.exe
:x*:xxoutlook::Run, outlook.exe
:x*:xxmspaint::
:x*:xxpaint::Run, mspaint.exe
:x*:xxedge::IfExistThenRun("C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe")
:x*:xxie::IfExistThenRun("C:\Program Files (x86)\Internet Explorer\iexplore.exe")
:x*:xxmpc::IfExistThenRun("C:\Program Files\MPC-HC\mpc-hc64.exe")
:x*:xxbc::
:x*:xxbeyondcompare::IfExistThenRun("C:\Program Files\Beyond Compare 4\bcompare.exe")
:x*:xxchrome::("C:\Program Files\Google\Chrome\Application\chrome.exe")
:x*:xxchium::("C:\Program Files\Chromium\Application\chromium.exe")
:x*:xxsteam::IfExistThenRun("C:\Program Files (x86)\Steam\steam.exe")
:x*:xxgpuz::IfExistThenRun("C:\Program Files (x86)\GPU-Z\GPU-Z.exe")
:x*:xxtreesize::IfExistThenRun("C:\Program Files (x86)\JAM Software\TreeSize Free\TreeSizeFree.exe")
:x*:xxanydesk::IfExistThenRun("C:\Program Files (x86)\AnyDesk\AnyDesk.exe")
:x*:xxzenmap::IfExistThenRun("C:\Program Files (x86)\Nmap\zenmap.exe")
:x*:xxscp::
:x*:xxwinscp::IfExistThenRun("C:\Program Files (x86)\WinSCP")
:x*:xxputty::IfExistThenRun("C:\ProgramData\chocolatey\bin\putty.exe")
:x*:xxcode::Run, code.exe
:x*:xxnpp::
:x*:xxnotepad::IfExistThenRun("C:\Program Files\Notepad++\notepad++.exe")
:x*:xx7z::IfExistThenRun("C:\Program Files\7-Zip\7zFM.exe")
:x*:xxpython::IfExistThenRun("C:\Python39\python.exe")
:x*:xxgit::IfExistThenRun("C:\Program Files\Git\git-bash.exe")
:x*:xxbash::Run, bash.exe
; System Apps
:x*:xxdiskman::Run, diskmgmt.msc ; Disk Management
:x*:xxcontrol::Run, control.exe ; Control Panel
; https://www.howtogeek.com/717570/how-to-use-microsoft-defender-antivirus-from-command-prompt-on-windows-10/
; MpCmdRun -Scan -ScanType 1 ; Quick
; MpCmdRun -Scan -ScanType 2 ; Full
; MpCmdRun -Scan -ScanType 3 -File PATH ; Custom, only scan a specific path
; MpCmdRun -Scan -ScanType -BootSectorScan
; MpCmdRun -Restore -ListAll ; List all quarantined files
; MpCmdRun -Restore -Name MyApp.exe ; Restore a specific file
; MpCmdRun -Restore -Name MyApp.exe -FilePath PATH ; Restore to a different location
; MpCmdRun -SignatureUpdate ; Update Signatures now
; MpCmdRun -h
; Latest version might also be here: C:\Program Files\Windows Defender
:x*:xxdefender1::
; try and convert the following from PowerShell over to AutoHotkey ...
; ("ls C:\ProgramData\Microsoft\Windows Defender\Platform\ |sort CreationTime -Descending|select -Expand FullName -First 1")