簡體   English   中英

我可以在 Emacs 的 shell 模式下使用 PowerShell 嗎?

[英]Can I use PowerShell in shell-mode for Emacs?

我可以在 emacs 的 shell 模式下使用 powershell 作為 shell 嗎?
如何?

請參閱 Jeffrey Snover 的博客文章PowerShell 在 Emacs 中運行

基於博客文章Run PowerShell as a shell in Emacs (2008 年 4 月),以及 Emacs Wiki 文章中關於 PowerShell 的部分稱為PowerShell 作為劣質 shell (2010 年 5 月更新):

  • powershell.el保存在 Emacs 安裝目錄下的.\\share\\emacs\\site-lispload-path任何其他目錄中。 powershell.el太長,無法包含在此答案中。如博客文章中所述,當重定向標准輸入和輸出時,無法強制 PowerShell 以交互模式運行,因此需要相當多的膠水代碼將其用作劣質外殼。)

  • 將以下內容添加到您的.emacs文件中

    (autoload 'powershell "powershell" "Run powershell as a shell within emacs." t)

完成后,使用Mx powershell打開並以交互方式使用 PS shell 緩沖區。

我想出了一個五襯里,而不是整個包裝,它足以滿足我的需要。 您可能想要快速適應它。

(defun powershell (&optional buffer)
  "Launches a powershell in buffer *powershell* and switches to it."
  (interactive)
  (let ((buffer (or buffer "*powershell*"))
    (powershell-prog "c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"))
    (make-comint-in-buffer "shell" "*powershell*" powershell-prog)
    (switch-to-buffer buffer)))

找出問題的最快方法是運行 shell-mode,然后從命令行運行 powershell。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM