Advertisement
aveyo

calc_single_instance_from_media_key

May 18th, 2018
1,546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.47 KB | None | 0 0
  1. @set @v=1 /* &echo off &title Calc single instance from media key
  2. set "calckey=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AppKey\18"
  3. reg add "%calckey%" /v ShellExecute /d "wscript.exe /e:JScript \"%~f0\"" /f &exit */
  4. calc=GetObject("winmgmts://./root/CIMv2").ExecQuery("Select * from Win32_Process WHERE Name LIKE 'Calculator.exe'")
  5. shell=WSH.CreateObject("WScript.Shell"); if (calc.Count>0) shell.AppActivate("Calculator"); else shell.Run('calc',1,'False');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement