我正在尝试从我的 build.xml 调用注销命令。我在我的 ant 目标中尝试了几种组合,例如:
<target name="bat">
<echo>Executing batch script</echo>
<exec dir="C:\WINDOWS\system32" executable="cmd">
<arg value="/c"/>
<arg value="logoff"/>
</exec>
</target>
但每次,我都会收到这个错误:“注销不被识别为内部或外部命令、可运行程序或批处理文件”
我不知道如何解决这个问题。感谢您的帮助。
编辑:
注销.xml
<?xml version="1.0"?>
<project name="logoff" default="off" basedir=".">
<target name="off">
<exec executable="cmd">
<arg value="/c"/>
<arg value="logoff"/>
</exec>
</target>
</project>
注销_xml.bat:
@echo off
set ANT_HOME=W:\lib\org.apache.ant
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_24
set PATH=%PATH%;%ANT_HOME%\bin
set BUILD_PATH=W:\logoff.xml
set ANT=call ant -buildfile %BUILD_PATH%
%ANT%
pause
echo %PATH%(带有 buid.xml bat 目标)
[exec] C:\Outils\GPS_510\bin;C:\Outils\GNATPRO_6.1.2\bin;C:\WINDOWS\system3
2;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Outils\Python25;C:\MinGW\bin;C:\Program
Files (x86)\IBM\RationalSDLC\common;C:\Program Files (x86)\IBM\RationalSDLC\Cle
arCase\bin;C:\Program Files (x86)\doxygen\bin;C:\Program Files (x86)\Citrix\Syst
em32\Citrix\IMA;C:\Program Files (x86)\Citrix\System32\Citrix\IMA\Subsystems;C:\
WINDOWS\System32\Citrix\IMA;C:\Program Files (x86)\Citrix\system32;C:\Program Fi
les (x86)\commonfiles\Citrix\System32\;C:\MinGW\msys\1.0\bin;c:\outils\cygw
in\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files (x86)\commonfiles
\Citrix\System32;C:\Program Files (x86)\Java\jre6\bin;lib\org.apache.an
t\bin
编辑:当我用 Ant 启动注销时,我得到:
[exec] Disconnecting
[exec] "logoff.exe is not recognized as an internal or external command, operable program or batch file"