Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows 綜合教學 >> 關於 Windows

Win10 右鍵新增選單加入「Windows PowerShell 腳本」建立 .ps1 檔案教學

編輯:關於 Windows

PowerShell 是 Win10 進階操作的利器,但預設右鍵「新增」選單沒有 PowerShell 腳本(.ps1)選項。透過註冊表新增 ShellNew 項目,即可在右鍵選單直接建立空的 .ps1 檔案,大幅提升腳本開發效率。

右鍵新增選單示意圖

操作步驟

  1. 搜尋列輸入 regedit 開啟登錄編輯器。
  2. 定位至:
    HKEY_CLASSES_ROOT\.ps1
  3. 在 .ps1 下右鍵新增「項」,命名為 ShellNew。
  4. 在 ShellNew 下右鍵新增「字串值」,命名為 NullFile,數值資料留空(代表建立空檔案)。
  5. 回到桌面或資料夾右鍵「新增」,即可看到「Windows PowerShell 腳本」選項。

新增 ShellNew 項

新增 NullFile 字串值

NullFile 設定完成

右鍵新增選單出現 PowerShell 腳本

新建 .ps1 檔案示意

雙擊用記事本開啟

使用提示

  • 新建的 .ps1 檔案雙擊預設用「記事本」開啟,亦可右鍵選「用 PowerShell ISE 編輯」(功能更強但啟動較慢)。
  • 若第一次右鍵未出現,多點幾次或重啟檔案總管即可生效。
Copyright © Windows教程網 All Rights Reserved