Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 如何使用Powershell作为我的tramp编码shell?_Windows_Powershell_Emacs_Plink_Tramp - Fatal编程技术网

Windows 如何使用Powershell作为我的tramp编码shell?

Windows 如何使用Powershell作为我的tramp编码shell?,windows,powershell,emacs,plink,tramp,Windows,Powershell,Emacs,Plink,Tramp,首先启动eshell,然后输入命令cd/plink:@:/home/ 然后我得到这个错误消息 Microsoft Windows[版本6.1.7601]版权所有(c)2009 Microsoft 公司版权所有 管理员已禁用命令提示符 按任意键继续 我正在尝试连接plink(在我的路径中),也是在通过*Messages*缓冲区之后,我发现了这个 找不到(C:\Windows\system32\cmd.exe)的本地shell提示符 我90%确信这是因为在我的机器上禁用了cmd,因为当我在另一台计算

首先启动eshell,然后输入命令
cd/plink:@:/home/

然后我得到这个错误消息

Microsoft Windows[版本6.1.7601]版权所有(c)2009 Microsoft 公司版权所有

管理员已禁用命令提示符

按任意键继续

我正在尝试连接plink(在我的路径中),也是在通过*Messages*缓冲区之后,我发现了这个

找不到(C:\Windows\system32\cmd.exe)的本地shell提示符

我90%确信这是因为在我的机器上禁用了cmd,因为当我在另一台计算机上尝试相同的设置时,我知道cmd已启用,一切正常

我已经修改了
.emacs
文件,以便

(require 'tramp)
(set 'tramp-encoding-shell "C:/Windows/System32/WindowsPowershell/v1.0/powershell.exe")
(set 'tramp-encoding-command-switch "-Command")
我得到了不同的结果,但是结果似乎是杂乱无章的(第三行看起来可能是一个提示,
\
字符位于正确的位置…)

我设法找到了一个非常好的
tramp编码shell
是什么,还有一个相关的,这是github上的
tramp编码shell

更新

以下是在尝试使用powershell设置为tramp编码外壳打开plink连接失败后,我的屏幕的外观


所以我不知道TRAMP,但对您得到的解释是Windows PowerShell将返回unicode(UTF16),在本例中,每个字符是16位字母a零,加上行尾是回车符/换行符(0xa,Oxd)

现在对于“emacs找不到PowerShell的本地shell提示符”错误,根据@Michael Albinus的建议似乎是有希望的

6.4.2在远程主机上运行shell

在与远程主机相关的缓冲区中调用M-x shell将运行本地shell,如
shell file name
中所定义。这可能也是要在远程主机上应用的shell的有效文件名,但至少当本地和远程主机属于不同的系统类型(如“windows nt”和“gnu/linux”)时,它会失败

必须将变量
explicit shell file name
设置为远程主机上的shell文件名,以便在远程主机上启动该shell

6.4.6在Windows主机上运行远程进程 在winexe的帮助下,可以在远程Windows主机上运行进程。TRAMP已经为进程文件和启动文件进程实现了这一点

变量tramp smb winexe程序必须包含本地winexe命令的文件名。在远程主机上,必须安装Powershell V2.0;它用于运行远程进程

为了通过M-x shell在Windows主机上打开远程shell,必须设置变量explicit shell file name和explicit-*-args。例如,如果要运行cmd,则必须设置:

(setq explicit-shell-file-name "cmd"
      explicit-cmd-args '("/q"))
如果将powershell作为远程shell运行,则设置为

(setq explicit-shell-file-name "powershell"
      explicit-powershell-args '("-file" "-"))

Windows PowerShell将返回unicode(UTF16),每个字符是16位,在本例中是字母a零,加上行尾是回车/换行符(0xa,Oxd),这可能解释了您得到的结果。@JPBlanc这是问题的一部分,我将
$OutputEncoding=New Object-typename System.Text.UTF8Encoding
添加到我的powershell配置文件中,这样就消除了乱码文本,但出现了“找不到(…powershell)的本地shell提示符”错误。我认为新的错误可能与您提到的EOL事件有关。@JPBlanc,经过进一步检查,它看起来像是。您能解释一下“找不到(…powershell)的本地shell提示符”错误的原因吗,也许是一个屏幕截图?@JPBlanc我添加了一个我看到的屏幕截图。右侧的窗口由emacs自动拉起。