cmd退出时显示错误代码1

时间:2017-08-03 12:05:23

标签: cmd remote-access psexec

我正在尝试使用PSEXEC在远程PC上搜索文件,但是我收到了上述错误。

任何可以建议任何更改命令或其他东西,可以帮助使其工作。 在线搜索表明这不是PSEXEC的问题,而是由远程主机上的explorer.exe引起的。

我添加了结果图片。我已经尝试过带有文件名引号的命令而没有。两者都有相同的错误。

enter image description here

3 个答案:

答案 0 :(得分:2)

此命令dir存在,代码为1,消息“未找到文件”。 因为您使用参数cmd运行/c而不是像dir那样返回相同的错误代码,并且它等于1.

这是正确的行为。

如果要查找文件,请使用命令where /r c:\ d.txt。此命令已在Windows 7中添加。

或者使用dir /S /P "d.txt"用于较旧的操作系统

答案 1 :(得分:0)

使用PowerShell也很容易,不需要psexec。

library(tidyr)
df %>% unite(col = coefficient, coefficient, p.value, sep = "")

# A tibble: 6 x 3
#       city     terms coefficient
#*     <chr>     <chr>       <chr>
#1 amsterdam intercept       23***
#2 amsterdam      food       0.54*
#3 amsterdam   service      -0.02 
#4 rotterdam intercept       18***
#5 rotterdam      food     0.86***
#6 rotterdam   service      0.67**

应该用.ps1脚本编写,并指定参数名称。

Invoke-Command HOST01 { & cmd.exe /C dir D:\Users\lit\d.txt }

另见:

Invoke-Command -ComputerName HOST01 -ScriptBlock { & cmd.exe /C dir D:\Users\lit\d.txt }

答案 2 :(得分:0)

windows+r打开注册表编辑器 然后输入 regedit 并按 Enter 现在在搜索栏中粘贴以下行

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\

如果您可以使用链接在图片中看到 Underlined mark is important don't insert any other value in the data of that particular registry

在这里,如果您提交了许多注册表值,则删除所有注册表值(默认值除外),因为它们是命令提示符显示错误代码 1 的主要原因。 所以在删除所有这些之后。

<块引用>

编辑默认注册表值并在'data'中插入cmd并保存

你的问题解决了!! 如果没有,则清除默认注册表的数据。

相关问题