Tệp PS1 là một tập lệnh hoặc lệnh ghép ngắn, được Windows PowerShell sử dụng.
Hướng dẫn này sẽ chỉ cho bạn cách thêm hoặc xóa menu Chỉnh sửa hoặc Chạy với tùy chỉnh vào menu ngữ cảnh cho tệp PowerShell .ps1 cho tất cả người dùng trong Windows 10.
Menu Chỉnh sửa hoặc Chạy với ngữ cảnh bao gồm các mục sau cho tệp PS1:
Chạy với PowerShellRun với PowerShell với tư cách quản trị viên Chạy với PowerShell 7Run với PowerShell 7 với tư cách quản trị viên Chỉnh sửa với PowerShell ISEEdit với PowerShell ISE với tư cách quản trị viên Chỉnh sửa với PowerShell ISE (x86) với tư cách quản trị viên Chỉnh sửa với NotepadEdit với Notepad với tư cách quản trị viênThêm “Chỉnh sửa hoặc Chạy với” vào menu chuột phải của tệp PS1 trong Windows 10
Cách thêm “Chỉnh sửa hoặc Chạy với” vào menu chuột phải của tệp PS1 trong Windows 10
Đây là cách thực hiện:
1. Thực hiện bước 2 (thêm – nhấp chuột phải), bước 3 (thêm – Shift + nhấp chuột phải) hoặc bước 4 (xóa) bên dưới tùy thuộc vào những gì bạn muốn làm.
2. Để thêm menu ngữ cảnh tệp “Chỉnh sửa hoặc Chạy với” PS1 (chỉ cần nhấp chuột phải để hiển thị), hãy tải xuống tệp Add_Edit_or_Run_with_to_PS1_context_menu.reg.
Nội dung của tệp REG) – Mã:
Windows Registry Editor Phiên bản 5.00
[-HKEY_CLASSES_ROOT.ps1]
[HKEY_CLASSES_ROOT.ps1]@ = “Microsoft.PowerShellScript.1″
[-HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1]
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1]”EditFlags” = dword: 00020000 “FriendlyTypeName” = hex (2): 40,00,22,00,25,00,73,00,79,00,73,00,74,00,65,00.6d, 00, 72,00,6f, 00,6f, 00,74,00,25,00,5c, 00,73,00,79,00,73,00,74,00,65,00.6d, 00, 33, 00,32,00,5c, 00,77,00,69,00,6e, 00,64,00,6f, 00,77,00,73,00,70,000.6f, 00, 77, 00,65, 00,72,00,73,00,68,00,65,00,6c, 00,6c, 00,5c, 00,76,00,31,00,2e, 00,30, 00, 5c, 00, 70,00,6f, 00,77,00,65,00,72,00,73,00,68,00,65,00,6c, 00,6c, 00,2e, 00,65, 00,78,00 , 65,00,22,00,2c, 00,2d, 00,31,00,30.00,33,000.00,00
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1DefaultIcon]@ = “” C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe “, 1”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1Shell]@ = “Mở”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellOpenCommand]@ = “” C: \ Windows \ System32 \ notepad.exe “”% 1 “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-with]”MUIVerb” = “Chỉnh sửa hoặc Chạy với” “Extended” = – “SubCommands” = “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 01flyout]”MUIVerb” = “Chạy với PowerShell” “Biểu tượng” = “powershell.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 01flyoutCommand]@ = “” C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe “” – Command “” if ((Get-ExecutionPolicy) -ne ‘AllSigned’) { Set-ExecutionPolicy -Scope Process Bypass}; & ‘%Đầu tiên'””
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 02flyout]”MUIVerb” = “Chạy với PowerShell với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “powershell.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 02flyoutCommand]@ = “” C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe “” – Command “” “& {Start-Process PowerShell.exe -ArgumentList ‘- ExecutionPolicy RemoteSigned -File \ “% 1 \” ‘-Verb RunAs} “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 03flyout]”MUIVerb” = “Chạy với PowerShell 7” “Biểu tượng” = “pwsh.exe” “CommandFlags” = dword: 00000020
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 03flyoutCommand]@ = “” C: \ Program Files \ PowerShell \ 7 \ pwsh.exe “” – Command “” if ((Get-ExecutionPolicy) -ne ‘AllSigned’) {Set-ExecutionPolicy – Bỏ qua quy trình phạm vi}; & ‘%Đầu tiên'””
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 04flyout]”MUIVerb” = “Chạy với PowerShell 7 với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “pwsh.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 04flyoutCommand]@ = “” C: \ Program Files \ PowerShell \ 7 \ pwsh.exe “” – Command “” “& {Start-Process pwsh.exe -ArgumentList ‘-ExecutionPolicy RemoteSigned -File \ “% 1 \” ‘-Verb RunAs} “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 05flyout]”MUIVerb” = “Chỉnh sửa bằng PowerShell ISE” “Biểu tượng” = “powershell_ise.exe” “CommandFlags” = dword: 00000020
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 05flyoutCommand]@ = “” C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe “”% 1 “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 06flyout]”MUIVerb” = “Chỉnh sửa bằng PowerShell ISE với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “powershell_ise.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 06flyoutCommand]@ = “PowerShell -windowstyle hidden -Command ” Start-Process cmd -ArgumentList ‘/ s, / c, start PowerShell_ISE.exe “”% 1 “”‘ -Verb RunAs “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 07flyout]”MUIVerb” = “Chỉnh sửa bằng PowerShell ISE (x86)” “Biểu tượng” = “powershell_ise.exe” “CommandFlags” = dword: 00000020
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 07flyoutCommand]@ = “” C: \ WINDOWS \ syswow64 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe “”% 1 “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 08flyout]”MUIVerb” = “Chỉnh sửa bằng PowerShell ISE (x86) với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “powershell_ise.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 08flyoutCommand]@ = “PowerShell -windowstyle hidden -Command ” Start-Process cmd -ArgumentList ‘/ s, / c, start C: \ WINDOWS \ syswow64 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe “” % 1 “” ‘-Verb RunAs “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 09flyout]”MUIVerb” = “Chỉnh sửa bằng Notepad” “Icon” = “notepad.exe” “CommandFlags” = dword: 00000020
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 09flyoutCommand]@ = “” C: \ Windows \ System32 \ notepad.exe “”% 1 “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 10flyout]”MUIVerb” = “Chỉnh sửa bằng Notepad với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “notepad.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 10flyoutCommand]@ = “PowerShell -windowstyle hidden -Command ” Start-Process cmd -ArgumentList ‘/ s, / c, start C: \ Windows \ System32 \ notepad.exe “”% 1 “”‘ – Động từ RunAs “”
3. Để thêm menu ngữ cảnh tệp “Chỉnh sửa hoặc Chạy với” PS1 (nhấn Shift + nhấp chuột phải để hiển thị), hãy tải xuống tệp Add_Shift + Edit_or_Run_with_to_PS1_context_menu.reg.
Nội dung của tệp REG – Mã:
Windows Registry Editor Phiên bản 5.00
[-HKEY_CLASSES_ROOT.ps1]
[HKEY_CLASSES_ROOT.ps1]@ = “Microsoft.PowerShellScript.1″
[-HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1]
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1]”EditFlags” = dword: 00020000 “FriendlyTypeName” = hex (2): 40,00,22,00,25,00,73,00,79,00,73,00,74,00,65,00.6d, 00, 72,00,6f, 00,6f, 00,74,00,25,00,5c, 00,73,00,79,00,73,00,74,00,65,00.6d, 00, 33, 00,32,00,5c, 00,77,00,69,00,6e, 00,64,00,6f, 00,77,00,73,00,70,000.6f, 00, 77, 00,65, 00,72,00,73,00,68,00,65,00,6c, 00,6c, 00,5c, 00,76,00,31,00,2e, 00,30, 00, 5c, 00, 70,00,6f, 00,77,00,65,00,72,00,73,00,68,00,65,00,6c, 00,6c, 00,2e, 00,65, 00,78,00 , 65,00,22,00,2c, 00,2d, 00,31,00,30.00,33,000.00,00
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1DefaultIcon]@ = “” C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe “, 1”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1Shell]@ = “Mở”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellOpenCommand]@ = “” C: \ Windows \ System32 \ notepad.exe “”% 1 “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-with]”MUIVerb” = “Chỉnh sửa hoặc Chạy với” “Extended” = “” “SubCommands” = “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 01flyout]”MUIVerb” = “Chạy với PowerShell” “Biểu tượng” = “powershell.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 01flyoutCommand]@ = “” C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe “” – Command “” if ((Get-ExecutionPolicy) -ne ‘AllSigned’) { Set-ExecutionPolicy -Scope Process Bypass}; & ‘%Đầu tiên'””
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 02flyout]”MUIVerb” = “Chạy với PowerShell với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “powershell.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 02flyoutCommand]@ = “” C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell.exe “” – Command “” “& {Start-Process PowerShell.exe -ArgumentList ‘- ExecutionPolicy RemoteSigned -File \ “% 1 \” ‘-Verb RunAs} “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 03flyout]”MUIVerb” = “Chạy với PowerShell 7” “Biểu tượng” = “pwsh.exe” “CommandFlags” = dword: 00000020
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 03flyoutCommand]@ = “” C: \ Program Files \ PowerShell \ 7 \ pwsh.exe “” – Command “” if ((Get-ExecutionPolicy) -ne ‘AllSigned’) {Set-ExecutionPolicy – Bỏ qua quy trình phạm vi}; & ‘%Đầu tiên'””
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 04flyout]”MUIVerb” = “Chạy với PowerShell 7 với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “pwsh.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 04flyoutCommand]@ = “” C: \ Program Files \ PowerShell \ 7 \ pwsh.exe “” – Command “” “& {Start-Process pwsh.exe -ArgumentList ‘-ExecutionPolicy RemoteSigned -File \ “% 1 \” ‘-Verb RunAs} “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 05flyout]”MUIVerb” = “Chỉnh sửa bằng PowerShell ISE” “Biểu tượng” = “powershell_ise.exe” “CommandFlags” = dword: 00000020
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 05flyoutCommand]@ = “” C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe “”% 1 “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 06flyout]”MUIVerb” = “Chỉnh sửa bằng PowerShell ISE với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “powershell_ise.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 06flyoutCommand]@ = “PowerShell -windowstyle hidden -Command ” Start-Process cmd -ArgumentList ‘/ s, / c, start PowerShell_ISE.exe “”% 1 “”‘ -Verb RunAs “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 07flyout]”MUIVerb” = “Chỉnh sửa bằng PowerShell ISE (x86)” “Biểu tượng” = “powershell_ise.exe” “CommandFlags” = dword: 00000020
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 07flyoutCommand]@ = “” C: \ WINDOWS \ syswow64 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe “”% 1 “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 08flyout]”MUIVerb” = “Chỉnh sửa bằng PowerShell ISE (x86) với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “powershell_ise.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 08flyoutCommand]@ = “PowerShell -windowstyle hidden -Command ” Start-Process cmd -ArgumentList ‘/ s, / c, start C: \ WINDOWS \ syswow64 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe “” % 1 “” ‘-Verb RunAs “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 09flyout]”MUIVerb” = “Chỉnh sửa bằng Notepad” “Icon” = “notepad.exe” “CommandFlags” = dword: 00000020
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 09flyoutCommand]@ = “” C: \ Windows \ System32 \ notepad.exe “”% 1 “”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 10flyout]”MUIVerb” = “Chỉnh sửa bằng Notepad với tư cách quản trị viên” “HasLUAShield” = “” “Biểu tượng” = “notepad.exe”
[HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-withshell 10flyoutCommand]@ = “PowerShell -windowstyle hidden -Command ” Start-Process cmd -ArgumentList ‘/ s, / c, start C: \ Windows \ System32 \ notepad.exe “”% 1 “”‘ – Động từ RunAs “”
4. Để xóa menu ngữ cảnh tệp PS1 “Chỉnh sửa hoặc Chạy với”, hãy tải xuống tệp Remove_Edit_or_Run_with_from_PS1_context_menu.reg.
Nội dung của tệp REG – Mã:
Windows Registry Editor Phiên bản 5.00
[-HKEY_CLASSES_ROOTMicrosoft.PowerShellScript.1ShellEdit-Run-with]
5. Lưu tệp .reg vào màn hình nền.
6. Nhấp đúp vào tệp .reg đã tải xuống để hợp nhất.
7. Khi được nhắc, hãy nhấp vào Chạy> Có (UAC)> Có> OK để phê duyệt hợp nhất.
8. Bây giờ bạn có thể xóa tệp .reg đã tải xuống nếu muốn.
Hy vọng bạn đang thành công.