programing

Windows 탐색기에서 PowerShell을 시작하는 방법

cafebook 2023. 4. 23. 11:27
반응형

Windows 탐색기에서 PowerShell을 시작하는 방법

Windows 탐색기에서 특정 폴더에서 PowerShell을 시작할 수 있는 방법이 있습니까? 예를 들어 폴더를 마우스 오른쪽 버튼으로 클릭하고 "이 폴더에서 PowerShell 열기"와 같은 옵션을 사용할 수 있습니까?

매일 MSBuild를 처음 실행할 때 프로젝트 폴더로 디렉토리를 변경해야 하는 것은 정말 귀찮습니다.

Windows 탐색기에서는 맨 위에 있는 주소 표시줄(키보드 바로 가기:D + 또는 +)L로 이동하여powershell ★★★★★★★★★★★★★★★★★」powershell_ise를 누릅니다. PowerShell 명령 창이 열리고 현재 디렉터리가 표시됩니다.

PowerShell 프롬프트에서 다음 작업을 수행할 수 있습니다.

ii .

또는

start .

현재 디렉토리에서 Windows 탐색기 창을 엽니다.

Windows 8 이상 버전을 사용하는 경우 기본 제공 파일 → "Windows PowerShell 열기"를 사용하면 됩니다.

또는 +에 이어 를 누릅니다.

매번 PowerShell 명령(powershell.exe)을 입력해야 하는 위의 답변 대신 "여기에 명령 창을 여는" 컨텍스트 메뉴에서와 같은 컨텍스트 메뉴 항목을 만들 수 있습니다.

이러한 명령어에는 3개의 레지스트리 키가 있습니다.각 키는 서로 다른 윈도우즈 탐색기 개체의 컨텍스트 메뉴를 제어합니다.첫 번째 질문은 다음과 같습니다.

  • HKCR\Directory\Background\shell - 탐색기 창 자체의 컨텍스트메뉴입니다(즉, 창의 빈 영역을 오른쪽 클릭하는 등 항목이 선택되지 않았을 때 표시되는 컨텍스트메뉴).
  • HKCR\Directory\shell - Windows 탐색기 폴더의 컨텍스트메뉴입니다
  • HKCR\Drive\shell - Windows 탐색기의 루트에 있는 드라이브 아이콘의 컨텍스트메뉴입니다

이러한 레지스트리 키 각각에 대해 컨텍스트 메뉴에 "여기서 PowerShell 창 열기" 명령을 추가하는 하위 키를 추가할 수 있습니다. 여기서 명령 창 열기" 컨텍스트 메뉴가 있는 것과 같습니다.

다음은 각 탐색기 개체, 창 배경, 폴더 및 드라이브 아이콘의 컨텍스트 메뉴에 명령을 저장하는 OpenPowerShellHere.reg 파일의 복사본입니다.

Windows Registry Editor Version 5.00

;
; Add context menu entry to Windows Explorer background
;
[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell]
@="Open PowerShell window here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

;
; Add context menu entry to Windows Explorer folders
;
[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="Open PowerShell window here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

;
; Add context menu entry to Windows Explorer drive icons
;
[HKEY_CLASSES_ROOT\Drive\shell\powershell]
@="Open PowerShell window here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Drive\shell\powershell\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

원하는 텍스트 편집기를 사용하여 OpenPowerShellHere.reg라는 새 파일을 엽니다.위의 코드의 텍스트를 그대로 복사하여 새 파일에 붙여넣고 저장합니다.(파일의 복사본을 포함했을 텐데 첨부파일이 가능한지 알 수 없었습니다.)엔트리에서 명령어를 제외하려면 세미콜론으로 해당 섹션을 주석 처리하십시오.제 댓글에는 각 섹션이 나와 있습니다.

파일을 저장한 후 두 번 클릭하여 실행합니다.요청하면 계속 진행하라고 합니다.실행하자마자 컨텍스트 메뉴 항목이 표시됩니다!

탐색기 창의 상황에 맞는 메뉴입니다.콘솔 및 PowerShell 명령어를 강조 표시했습니다.보시다시피 컨텍스트 메뉴 항목을 추가하여 관리자 권한으로 실행과 같은 높은 명령 창을 실행할 수도 있습니다.

탐색기의 상황에 맞는 메뉴의 PowerShell 항목

주의: 컨텍스트메뉴 엔트리는 레지스트리 키에 따라 알파벳 순으로 표시됩니다.상승된 명령 셸의 키 이름은 "runas"이므로 PowerShell 항목 뒤에 나옵니다.

주의: 탐색기 창이 열려 있는 경우 변경 내용을 적용하려면 탐색기 창을 닫았다가 다시 열어야 할 수 있습니다.

주의: Windows 7에서는HKCR\Directory\Shell는, 경우는 기능하지 .

(즉, 라이브러리 머리글 아래 문서 클릭)

하다, 하다, 하다, 하다를 사용해서 길을 찾아야 .Computer -> C: -> to -> Some -> Target -> Directory

여기서 inf 파일을 다운로드할 수 있습니다.PowerShell 프롬프트 소개는 이쪽

Windows 10 에서는 명령 프롬프트와 powershell 프롬프트는 모두 메뉴바에서 찾을 수 있습니다(admin 이외와 admin 모두).이러한 옵션은 해당 폴더를 탐색기에서 현재 선택한 폴더로 설정합니다.

적어도 스웨덴 버전에서는 powershell이 F+I로 열립니다.관리자의 경우 powershell은 입니다.F+S+P

Windows Powershell 메뉴

올바른 문자가 아닌 경우 키를 누른 상태로 올바른 문자를 볼 수 있습니다.각 스텝의 메뉴 항목 위에 문자가 겹쳐집니다.

아무도 이 답을 주지 않았다니 놀랍네요. 가장 간단한 답이에요. (연도가 틀림없어요.)

탐색기에서 Shift + 마우스 오른쪽 버튼을 클릭하십시오.여기서 PowerShell 창을 엽니다.

기본적으로는 명령 프롬프트로 설정될 수 있습니다.이 경우 Windows 10 설정에서 변경할 수 있습니다.[ Personalization ]-> [ Taskbar ]으로 이동하여 [Replace Command Prompt with Windows PowerShell](명령 프롬프트를 Windows PowerShell로 교체)를 활성화하여 [시작]버튼을 오른쪽 클릭하거나 Windows 키+X 키를 누릅니다.

Windows 10은 이것을 훨씬 쉽게 만들었다.다음 중 하나를 수행할 수 있습니다.

  • SHIFT + 폴더에 있으면 메뉴 항목이 나타납니다.Open PowerShell window here.

또는 다음 작업을 수행할 수 있습니다.

  • File->Open Windows PowerShell.

그리고 보너스로...

온의 경우File->Open Windows PowerShell 하면 Add to Quick Access Toolbar:

여기에 이미지 설명 입력

여기에 편리한 아이콘이 표시됩니다.

여기에 이미지 설명 입력

이제 이 아이콘을 클릭하기만 하면 됩니다.:)

이 콘텍스트메뉴는 'SHIFT'를 우클릭하고 길게 눌렀을 때만 작동하도록 하고 싶었습니다.이것은 내장된 'Open Command window here' 콘텍스트메뉴의 동작 방식입니다.

중 어느 하지 에 나는 내 의 해결책을 밖에 없었다..reg합니다.power-shell-here-on-shift.reg더블 클릭을 합니다.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="Open PowerShell here"
"NoWorkingDirectory"=""
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"

여기서 Shift 키를 누른 상태에서 오른쪽 클릭을 누르면서 전원 셸을 엽니다.

PowerShell PowerToy를 사용해 보세요...Open PowerShell Here에 대한 컨텍스트 메뉴 항목을 추가합니다.

또는 시작 폴더를 프로젝트 폴더로 하여 PowerShell을 여는 바로 가기를 만들 수도 있습니다.

최신 버전에서는 Windows 10의 컨텍스트메뉴에 [+]가 Mouse Right Click디폴트로 「여기서 PowerShell 창을 엽니다」라고 되어 있습니다.어쨌든 지금쯤은 Windows 터미널을 사용하고 있을 것입니다.

Windows 8.1 및 Server 2012 R2에서는 더욱 간단합니다.

한 번 실행: 태스크 바를 마우스 오른쪽 버튼으로 클릭하고 Properties왼쪽 하단 모서리를 오른쪽 클릭하거나 Windows+X를 누르면 탐색 탭에서 메뉴에서 []] Replace Command Prompt to Windows PowerShell을 켜십시오.

그런 다음 PowerShell 프롬프트가 필요할 때마다 를 누릅니다.(관리 PowerShell 프롬프트의 경우 ).

적어도 명령 프롬프트 창을 열 수 있는 SVN용 도구를 만드는 사람이 만든 Windows 탐색기 확장 기능이 있습니다.

아직 시도해보지 않았기 때문에 PowerShell을 사용할 수 있을지 모르겠지만 Stack Overflow 형제들과 사랑을 나누고 싶었습니다.

http://tools.tortoisesvn.net/StExBar

또 다른 옵션으로는 TechNet(http://technet.microsoft.com/en-us/magazine/2008.06.elevation.aspx에서 Michael Murgolo가 제공하는 뛰어난 Elevation PowerToys가 있습니다.

관리자로서 PowerShell Prompt Here와 PowerShell Prompt Here가 있습니다.

Windows 10 에서는, 이하의 레지스트리 키를 추가하는 것에 의해서, Windows 10 에서는, 「Open PowerShell Here」옵션을 취득할 수 있었습니다.SHIFT + RClick하여 저장하기만 하면 됩니다..reg키를 추가하기 위해 파일을 저장하고 실행합니다.그것부터 동작합니다.다른 답변 중에는 키를 HKCR\Directory\shell에 추가하는 답변도 있습니다만, 저는 키가 HKLM\SOFTWARE\Classes\들어가는 경우에만 사용할 수 있다는 것을 알았습니다.디렉토리\shell

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell]
"Extended"=""
"NoWorkingDirectory"=""
@="Open PowerShell here"
"Icon"="%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell]
@="Open PowerShell here"
"Extended"=""
"Icon"="%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"
"NoWorkingDirectory"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
if(-not (Test-Path -Path "HKCR:\Directory\shell\$KeyName"))
{
    Try
    {
        New-Item -itemType String "HKCR:\Directory\shell\$KeyName" -value "Open PowerShell in this Folder" -ErrorAction Stop
        New-Item -itemType String "HKCR:\Directory\shell\$KeyName\command" -value "$env:SystemRoot\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command Set-Location '%V'" -ErrorAction Stop
        Write-Host "Successfully!"
     }
     Catch
     {
         Write-Error $_.Exception.Message
     }
}
else
{
    Write-Warning "The specified key name already exists. Type another name and try again."
}

Windows 탐색기에서 PowerShell을 시작하는 방법에서 세부 스크립트를 다운로드할 수 있습니다.

한 가지 매우 간단한 방법은 바로 가기를 통해 PowerShell을 호출하는 것입니다.바로 가기를 호출할 때 사용할 디렉토리(폴더)를 알려주는 "시작 위치"라는 바로 가기 속성이 있습니다.

[ Start In ]박스가 공백인 경우는, 현재의 디렉토리를 사용하고 있는 것을 의미합니다.

일반적인 방법으로 PowerShell 바로 가기를 처음 생성할 때 시작 위치 상자에 홈 디렉터리가 지정됩니다.start in 박스를 공백으로 하면 현재 디렉토리에서 PS를 여는 powershell 바로가기가 나타납니다.

이 숏컷을 타겟디렉토리에 카피하고, 탐색기를 사용해 기동하면, 타겟디렉토리를 가리키는 PS가 기동합니다.

이 질문에는 이미 받아들여진 답이 있지만, 다른 방법으로 이것을 제안합니다.

자동 키 사용자의 경우 사용 중인 스니펫을 참조하십시오.

PowerShell 키를 창이 .Ctrl-Alt-T () (Win10으로 테스트 완료)

"활성 창"이 Windows 탐색기 창인 경우 현재 폴더에서 PowerShell이 열립니다.그렇지 않으면 일부 기본 폴더에서 PowerShell을 여십시오.

사용방법: 1) AutoHotkey를 설치하고 myscript에 복사하여 붙여넣습니다.ahk 2) 교환<DefaultPath> 3) 스크립트를 실행합니다.

; Ctrl-Alt-T opens PowerShell in the current folder, if using Windows Explorer. Otherwise, just open the Powershell.
^!T::
if WinActive("ahk_class CabinetWClass") and WinActive("ahk_exe explorer.exe")
{
    KeyWait Control
    KeyWait Alt
    Send {Ctrl down}l{Ctrl up}
    Send powershell{Enter}
}
else
{
    psScript =
    (
    cd 'C:\<DefaultPath>'
    ls
    )
    Run "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" -NoExit -Command &{%psScript%}
}
return

PS 및 CMD 컨텍스트 항목을 추가하기 위해 완전히 자동화된 솔루션을 만들었습니다.set_registry.cmd를 실행하면 폴더 또는 열려 있는 일부 폴더 내에서 RMB를 클릭하면 레지스트리가 갱신되어 두 개의 버튼이 추가됩니다.

합니다.
및 컨텍스트메뉴를합니다.

Windows 10 에서는, 이것만이 유효했습니다.

다음 내용으로 PowershellHereContextMenu.reg라는 파일을 만들고 해당 파일을 마우스 오른쪽 버튼으로 클릭한 후 "Merge"를 클릭합니다.

Windows Registry Editor Version 5.00

;
; Add context menu entry to Windows Explorer folders
;
[HKEY_CLASSES_ROOT\Directory\shell\powershellmenu]
@="PowerShell Here"

[HKEY_CLASSES_ROOT\Directory\shell\powershellmenu\command]
@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"

;
; Add context menu entry to Windows Explorer background
;
[HKEY_CLASSES_ROOT\Directory\Background\shell\powershellmenu]
@="PowerShell Here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\powershellmenu\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

;
; Add context menu entry to Windows Explorer drive icons
;
[HKEY_CLASSES_ROOT\Drive\shell\powershellmenu]
@="PowerShell Here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Drive\shell\powershellmenu\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

파일 탐색기의 임의의 위치에서 관리자로 PowerShell을 실행하려면 해당 폴더로 이동하고 바로 가기 "alt + f + s + a"를 사용하여 특정 폴더 위치에서 관리자로 powershell을 엽니다.

Windows 탐색기 주소 표시줄에서 다음 명령을 실행하여 powershell을 열면 이 디렉토리에 대한 경로가 열립니다.

powershell.exe -noexit - 명령어 "Write-Host "Hello World"

언급URL : https://stackoverflow.com/questions/183901/how-do-i-start-powershell-from-windows-explorer

반응형