I need to start a .bat
file on a remote pc via psexec
. The remote pc has usr and pwd set:
usr= username
pwd= password"123
In cmd
it works fine , just put a \
in front of "
(psexec \\remote-pc -d -u username -p password\"123
)
But, the point is that I have this arg line defined in my build.xml and i'm not able to start it by using ANT
.
I tried by changing the "
with "
and other stuffs i found but no way.
any idea? maybe it's easier to change the pwd of my machines :-)
thank you !
As a rule of thumb use 1-n nested arg value elements instead of arg line,
see ant manual commandline arguments.
Splitting your arg line into several arg value ... should work, see :
<exec executable="c:\pstools\psexec.exe">
<arg value="\\hostname"/>
<arg value="/accepteula"/>
<arg value="cmd"/>
<arg value="/c"/>
<arg value="echo"/>
<arg value="password"123"/>
</exec>
output :
[exec] PsExec v1.98 - Execute processes remotely
[exec] Copyright (C) 2001-2010 Mark Russinovich
[exec] Sysinternals - www.sysinternals.com
[exec] cmd exited with error code 0.
whereas :
<exec executable="c:\pstools\psexec.exe">
<arg line="\\hostname /accepteula cmd /c echo password"123"/>
</exec>
output :
BUILD FAILED
.. unbalanced quotes in \\hostname /accepteula cmd /c echo password"123