Computer >> Hướng Dẫn Máy Tính >  >> Hệ Thống >> Windows 11

Cách Thêm Tùy Chọn "Mở Cửa Sổ Lệnh" Vào Menu Ngữ Cảnh Windows 11

Command Prompt từng là trình thông dịch dòng lệnh mặc định của Windows để mở thư mục và file. PowerShell dần thay thế nó. Tuy nhiên, nhiều người dùng quen thuộc với bộ lệnh Command Prompt vẫn thích dùng trình thông dịch này hơn PowerShell.

Vì Command Prompt không còn là trình thông dịch dòng lệnh chính, tùy chọn "open command window here" (mở cửa sổ lệnh tại đây) đã biến mất khỏi menu ngữ cảnh trong Windows 11 và 10. Tùy chọn này cho phép mở thư mục trong Command Prompt bằng cách click chuột phải thư mục từ File Explorer. Dưới đây là cách khôi phục tùy chọn đó trên menu ngữ cảnh Windows 11.

Khôi Phục Tùy Chọn Mở Cửa Sổ Lệnh Bằng Registry Script

Để khôi phục tùy chọn Open command window here trên menu ngữ cảnh, bạn cần áp dụng registry tweak (thay đổi registry) một cách hay cách khác. Thay vì tự chỉnh registry thủ công, bạn có thể tạo file script registry (.reg) làm việc đó. Các bước tạo file REG script khôi phục tùy chọn Open command window bị mất:

  1. Nhấn nút tìm kiếm Windows (biểu tượng kính lúp) trên taskbar.
  2. Gõ Notepad trong công cụ tìm kiếm, chọn mở app đó.
  3. Sao chép mã registry script dưới với Ctrl + C:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\Shell\OpenElevatedCmd]
    @="Open command prompt here as administrator"
    "Icon"="cmd.exe"
    
    [HKEY_CLASSES_ROOT\Directory\Shell\OpenElevatedCmd\command]
    @="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""
    
    [HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenElevatedCmd]
    @="Open command prompt here as administrator"
    "Icon"="cmd.exe"
    
    [HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenElevatedCmd\command]
    @="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""
    
    [HKEY_CLASSES_ROOT\Drive\Shell\OpenElevatedCmd]
    @="Open command prompt here as administrator"
    "Icon"="cmd.exe"
    
    [HKEY_CLASSES_ROOT\Drive\Shell\OpenElevatedCmd\command]
    @="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""
    
    [HKEY_CLASSES_ROOT\LibraryFolder\background\Shell\OpenElevatedCmd]
    @="Open command prompt here as administrator"
    "Icon"="cmd.exe"
    
    [HKEY_CLASSES_ROOT\LibraryFolder\background\Shell\OpenElevatedCmd\command]
    @=
  4. Click vào Notepad và nhấn Ctrl + V dán script vào trình soạn thảo.
  5. Chọn File > Save as trong Notepad.
  6. Chọn All Files trên menu thả xuống Save as type.
  7. Nhập Open command window (Admin).reg vào ô File name.
  8. Chọn Desktop bên trái cửa sổ Save as.
  9. Click Save.
  10. Đóng Notepad, double-click file Open command window.reg trên desktop.
  11. Chọn Yes trên lời nhắc Registry Editor, click OK.

Bây giờ bạn có tùy chọn mới Open Command Prompt here trên menu ngữ cảnh. Click chuột phải thư mục trong File Explorer, chọn Show more options. Chọn Open Command Prompt here as administrator để mở thư mục trong cửa sổ Command Prompt.

Bạn có thể xóa tùy chọn đó khỏi menu bằng cách xóa registry key. Mở Registry Editor: nhấn Windows + R, gõ regedit vào ô Open, chọn OK.

Đi đến key Computer\HKEY_CLASSES_ROOT\Directory\shell trong Registry Editor. Click chuột phải key OpenElevatedCmd chọn Delete. Click Yes xác nhận.

Khôi Phục Tùy Chọn Mở Cửa Sổ Lệnh Bằng Winaero Tweaker

Ứng dụng desktop miễn phí Winaero Tweaker cung cấp cách thay thế khôi phục tùy chọn Open command window trên menu ngữ cảnh. Phần mềm có tùy chọn Command Prompt as Administrator để thêm phím tắt Open command window cho thư mục vào menu chuột phải. Cách cài Winaero Tweaker và chọn tùy chọn đó:

  1. Mở trang chủ Winaero Tweaker.
  2. Click liên kết Download Winaero Tweaker.
  3. Nhấn Windows và E cùng lúc, mở thư mục lưu file ZIP Winaero Tweaker.
  4. Double-click file ZIP Winaero Tweaker, chọn Extract all của Explorer.
  5. Chọn Show extracted files when complete trên cửa sổ Extract Compressed Folders.
  6. Click Extract giải nén thư mục Winaero Tweaker.
  7. Double-click WinaeroTweaker-1.33.0.0-setup mở installer, click Next.
  8. Chọn Normal mode, I accept the agreement, Create a desktop icon trong cửa sổ setup. Click Install.
  9. Double-click phím tắt Winaero Tweaker trên desktop.
  10. Mở rộng danh mục Context Menu trong Winaero Tweaker.
  11. Click tùy chọn Command Prompt as Administrator.
  12. Chọn ô Add elevated Command Prompt to the context menu.
  13. Xóa text trong ô Context menu entry title. Nhập Open command window here vào ô đó.
  14. Nhấn Apply Changes, đóng Winaero Tweaker.

Kiểm tra tùy chọn menu ngữ cảnh mới: click chuột phải thư mục chọn Show more options. Hoặc chọn thư mục nhấn Shift + F10. Chọn Open command window here trên menu ngữ cảnh cổ điển sẽ mở thư mục trong Command Prompt nâng cao như registry script.

Cấu Hình Tùy Chọn "Open In Windows Terminal" Để Mở Với Command Prompt

Menu ngữ cảnh Windows 11 có tùy chọn Open in Windows Terminal mở thư mục trong trình thông dịch mặc định của Terminal. PowerShell là trình thông dịch mặc định, nhưng bạn có thể đổi thành Command Prompt. Khi đó thư mục sẽ mở trong tab Command Prompt khi chọn Open in Windows Terminal.

  1. Click chuột phải Start trên taskbar chọn mở Windows Terminal.
  2. Click nút Open a new tab (mũi tên) chọn Settings.
  3. Chọn Command Prompt trên menu thả xuống Default profile.
  4. Nhấn Save góc dưới phải tab Settings.
  5. Click Close góc trên phải Windows Terminal.

Thử chọn Open in Windows Terminal click chuột phải thư mục. Windows Terminal sẽ mở với tab Command Prompt. Nếu thích Command Prompt mở cửa sổ administrator riêng biệt, bạn cần thêm tùy chọn mới vào menu ngữ cảnh như hai phương pháp trước.

Tùy Chọn "Open Command Window Here" Là Phím Tắt Command Prompt Tiện Lợi

Tùy chọn Open command window here trên menu ngữ cảnh là phím tắt tiện lợi cho mọi người dùng Command Prompt. Có tùy chọn đó trên menu chuột phải giúp không cần mở thủ công thư mục trong Prompt bằng lệnh change directory (CD). Vì vậy, đáng khôi phục tùy chọn đó trong Windows 11 nếu bạn thường dùng Command Prompt.