“远程命令失败,退出状态为 127”
“Remote command failed with exit status 127”
我有一个批处理文件如下:
@echo off
REM <--Fetching installed service pack version and storing it in var-->
FOR /f "tokens=* " %%a in ('findstr /I "install.servicepack" ^< "C:\A\B\C\D.properties" ') DO SET temp=%%a
SET var=%temp:~22%
REM <-- I tested, correct value is getting assigned to var say 1.2.3-->
REM <--Next, I am changing the directory using CD, in which X, Y and Z is a fixed directory path and after that it is variable based upon %var% value
cd c:\X\Y\Z\%var%
echo %cd%
REM <-- I tested and directory is correctly set against cd c:\X\Y\Z.2.3
REM <--With in c:\X\Y\Z\%var% (c:\X\Y\Z.2.3), there is an exe called uninstaller.exe and I am executing it is below:
dir
ECHO MESSAGE: Starting Silent Uninstallation of ABC Package
uninstaller.exe -options -silent
ECHO MESSAGE: Finished Silent Uninstallation of ABC Package
设置:我在 windows 上安装了 Jenkins 并通过 ANT 中的 sshexec 任务,我在远程 [=31= 中调用上述批处理文件] 机器使用 cygwin openssh.
问题:当使用上述设置从 Jenkins 作业调用上述脚本时,它返回“远程命令失败,退出状态为 127”。但是,如果我将 cd 中 %var% 的值硬编码为 cd c:\X\Y\Z\a.b.c 而不是作为 cd c:\X\Y\Z\%var% 传递,脚本正在执行很好,即;直接用确切路径更改目录 (cd C:\X.Y.Z.\1.2.3).
更改目录后,我尝试了几种调用 uninstaller.exe 的方法,但没有成功。
请帮忙。
不要更改 TEMP
变量的值:这是一个特殊的系统变量,用于保存临时目录 env。变量。
请选择其他变量名。
FOR /f "tokens=* " %%a in ('findstr /I "install.servicepack" ^< "C:\A\B\C\D.properties" ') DO SET t=%%a
SET var=%t:~22%
如果更改临时目录,依赖它的程序可能会崩溃(而且有很多)。
我有一个批处理文件如下:
@echo off
REM <--Fetching installed service pack version and storing it in var-->
FOR /f "tokens=* " %%a in ('findstr /I "install.servicepack" ^< "C:\A\B\C\D.properties" ') DO SET temp=%%a
SET var=%temp:~22%
REM <-- I tested, correct value is getting assigned to var say 1.2.3-->
REM <--Next, I am changing the directory using CD, in which X, Y and Z is a fixed directory path and after that it is variable based upon %var% value
cd c:\X\Y\Z\%var%
echo %cd%
REM <-- I tested and directory is correctly set against cd c:\X\Y\Z.2.3
REM <--With in c:\X\Y\Z\%var% (c:\X\Y\Z.2.3), there is an exe called uninstaller.exe and I am executing it is below:
dir
ECHO MESSAGE: Starting Silent Uninstallation of ABC Package
uninstaller.exe -options -silent
ECHO MESSAGE: Finished Silent Uninstallation of ABC Package
设置:我在 windows 上安装了 Jenkins 并通过 ANT 中的 sshexec 任务,我在远程 [=31= 中调用上述批处理文件] 机器使用 cygwin openssh.
问题:当使用上述设置从 Jenkins 作业调用上述脚本时,它返回“远程命令失败,退出状态为 127”。但是,如果我将 cd 中 %var% 的值硬编码为 cd c:\X\Y\Z\a.b.c 而不是作为 cd c:\X\Y\Z\%var% 传递,脚本正在执行很好,即;直接用确切路径更改目录 (cd C:\X.Y.Z.\1.2.3).
更改目录后,我尝试了几种调用 uninstaller.exe 的方法,但没有成功。
请帮忙。
不要更改 TEMP
变量的值:这是一个特殊的系统变量,用于保存临时目录 env。变量。
请选择其他变量名。
FOR /f "tokens=* " %%a in ('findstr /I "install.servicepack" ^< "C:\A\B\C\D.properties" ') DO SET t=%%a
SET var=%t:~22%
如果更改临时目录,依赖它的程序可能会崩溃(而且有很多)。