바로가기를 통해 Windows에서 앱 실행 또는 명령 실행

바로가기를 통해 Windows에서 앱 실행 또는 명령 실행

보고 있는 위치(데스크탑, 폴더 등)에 관계없이 바로가기가 "들려" 적절한 작업이 수행되도록 Windows 7에 바로가기를 등록할 수 있습니까?

예를 들어, 바로 가기 이름으로 실행을 사용하면 작동하는 System32 폴더에 바로 가기를 만드는 것은 예를 들어 바탕 화면에 포커스가 설정되어 있을 때 키 조합을 설정하면 작동하지 않습니다.

최상위 바로가기를 등록하는 기본 방법이나 이를 활성화하는 애플리케이션이 있습니까?

키보드 단축키를 원하는 항목의 예:

  • %path%와 같은 특정 폴더를 엽니다.
  • 현재 폴더에 새 .js 파일을 만듭니다.
  • 앱이 이를 지원하는 경우(예: 명령 프롬프트) 현재 위치로 설정된 경로로 애플리케이션을 실행합니다.

감사합니다.

답변1

당신은 아마 이것을 할 수 있습니다오토핫키.

Win예를 들어 바로가기 + 를 S실행 하려고 한다고 가정해 보겠습니다 MyScript. AutoHotKey를 설치하고 AutoHotkey.ahk 파일에 다음 내용을 복사한 후 AutoHotKey를 다시 시작하세요.

SetTitleMatchMode RegEx
return

; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass

    #s::
        LaunchMyScriptInCurrent()
    return
#IfWinActive


; Launches a custom script in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
;
LaunchMyScriptInCurrent()
{
    ; This is required to get the full path of the file from the address bar
    WinGetText, full_path, A

    ; Split on newline (`n)
    StringSplit, word_array, full_path, `n
    ; Take the first element from the array
    full_path = %word_array1%   

    ; strip to bare address
    full_path := RegExReplace(full_path, "^Address: ", "")

    ; Just in case - remove all carriage returns (`r)
    StringReplace, full_path, full_path, `r, , all

    IfInString full_path, \
    {
        Run, C:\Path\To\MyScript "%full_path%"
    }
    else
    {
        Run, C:\Path\To\MyScript "C:\ "
    }
}

이 두 가지 답변에서 영감을 얻었습니다.

  1. https://superuser.com/a/205368/118346
  2. https://stackoverflow.com/a/100648/1005455

관련 정보