You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Limor <li...@evolven.com> on 2010/06/09 11:07:27 UTC

Psexec and ant

Hello
I'm trying to use Psexec by using ant with no success... 

ant task:
<target name="myName" dir="." output="myOutput">  
    <exec executable="psexec.exe" dir="${build.files}" >
            <arg value="\\172.16.191.2"/>
            <arg value="-u" />
            <arg value="myUser" />
            <arg value="-p" />
            <arg value="myPass" />
            <arg value="-c" />            
            <arg value="runme2.bat" />    
            <arg value="myValue" />      
    </exec>  
</target>

output is:

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com


Connecting to 172.16.191.2...


Starting PsExec service on 172.16.191.2...


Connecting with PsExec service on 172.16.191.2...


Copying runme2.bat to 172.16.191.2...


Starting runme2.bat on 172.16.191.2...



runme2.bat exited on 172.16.191.2 with error code 1.



runme2.bat:

::@echo off 
echo 1 > c:\l.txt
cd "C:\Documents and Settings\Administrator\Desktop\script\">> c:\l.txt

"C:\Documents and Settings\Administrator\Desktop\script\runB.bat" %1 
echo 2 >> c:\l.txt
exit /b 0


Note:
when I'm running the same command from cmd it works fine.

Does someone have any suggetions?

Thanks in advance,

-- 
View this message in context: http://old.nabble.com/Psexec-and-ant-tp28827734p28827734.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Psexec and ant

Posted by Limor <li...@evolven.com>.
Thank you  both (Michael &Daniel).Although I already tried the cmd withe \k I
will try it again, and I will try the Michael's solution and I will let knew
what happens
I bothe are the BEAST!!!!
Thanks 
Limor

Michael Ludwig-6 wrote:
> 
> Daniel Blaukopf schrieb am 09.06.2010 um 18:56 (+0300):
>> Since psexec.exe expects to be run from a command shell, you might get
>> better results running "cmd /c psexec.exe \\172..." from Ant.
> 
> But it's not always required to include cmd.exe. This works fine:
> 
>           \,,,/
>           (o o)
> ------oOOo-(_)-oOOo------
> <project default="netstat">
> 
>   <target name="netstat">
>     <exec executable="netstat.exe">
>       <arg value="/ano" />
>       <arg value="/p" />
>       <arg value="tcp" />
>     </exec>
>   </target>
> 
>   <target name="ipconfig">
>     <exec executable="ipconfig.exe">
>       <arg value="/all" />
>     </exec>
>   </target>
> 
> </project>
> 
> -- 
> Michael Ludwig
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Psexec-and-ant-tp28827734p28887450.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Psexec and ant

Posted by Michael Ludwig <mi...@gmx.de>.
Daniel Blaukopf schrieb am 09.06.2010 um 18:56 (+0300):
> Since psexec.exe expects to be run from a command shell, you might get
> better results running "cmd /c psexec.exe \\172..." from Ant.

But it's not always required to include cmd.exe. This works fine:

          \,,,/
          (o o)
------oOOo-(_)-oOOo------
<project default="netstat">

  <target name="netstat">
    <exec executable="netstat.exe">
      <arg value="/ano" />
      <arg value="/p" />
      <arg value="tcp" />
    </exec>
  </target>

  <target name="ipconfig">
    <exec executable="ipconfig.exe">
      <arg value="/all" />
    </exec>
  </target>

</project>

-- 
Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Psexec and ant

Posted by Daniel Blaukopf <Da...@Sun.COM>.
Hi Limor,

Since psexec.exe expects to be run from a command shell, you might get
better results running "cmd /c psexec.exe \\172..." from Ant.
For more information you will have to send details of what you expected
to see and what you did see when running Ant.

Daniel


On Wed, 2010-06-09 at 08:04 -0700, Limor wrote: 
> 
> 
> Michael Ludwig-6 wrote:
> > 
> > [Psexec and ant]
> > Limor schrieb am 09.06.2010 um 02:07 (-0700):
> >> 
> >> Hello
> >> I'm trying to use Psexec by using ant with no success... 
> >> 
> >> ant task:
> >> <target name="myName" dir="." output="myOutput">  
> >>     <exec executable="psexec.exe" dir="${build.files}" >
> >>             <arg value="\\172.16.191.2"/>
> >>             <arg value="-u" />
> >>             <arg value="myUser" />
> >>             <arg value="-p" />
> >>             <arg value="myPass" />
> >>             <arg value="-c" />            
> >>             <arg value="runme2.bat" />    
> >>             <arg value="myValue" />      
> >>     </exec>  
> >> </target>
> >> 
> >> output is:
> > 
> > The output I snipped doesn't look like Ant output. Did you run Ant at
> > all? If so, you should have seen syntax errors for including "dir" and
> > "output" attributes in your <target>, which don't belong there.
> > 
> > See Ant manual: "Concepts and Types" > "Targets and Extension-Points"
> > 
> > -- 
> > Michael Ludwig
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> > 
> > 
> > 
> Hi
> and thanks for the quick response
> This is not an ant error this is win or psexec error,however I get this erro
> only wen I'am tring to run the batch form ant
> Thanks 
> Limor



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Psexec and ant

Posted by Limor <li...@evolven.com>.


Michael Ludwig-6 wrote:
> 
> [Psexec and ant]
> Limor schrieb am 09.06.2010 um 02:07 (-0700):
>> 
>> Hello
>> I'm trying to use Psexec by using ant with no success... 
>> 
>> ant task:
>> <target name="myName" dir="." output="myOutput">  
>>     <exec executable="psexec.exe" dir="${build.files}" >
>>             <arg value="\\172.16.191.2"/>
>>             <arg value="-u" />
>>             <arg value="myUser" />
>>             <arg value="-p" />
>>             <arg value="myPass" />
>>             <arg value="-c" />            
>>             <arg value="runme2.bat" />    
>>             <arg value="myValue" />      
>>     </exec>  
>> </target>
>> 
>> output is:
> 
> The output I snipped doesn't look like Ant output. Did you run Ant at
> all? If so, you should have seen syntax errors for including "dir" and
> "output" attributes in your <target>, which don't belong there.
> 
> See Ant manual: "Concepts and Types" > "Targets and Extension-Points"
> 
> -- 
> Michael Ludwig
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 
Hi
and thanks for the quick response
This is not an ant error this is win or psexec error,however I get this erro
only wen I'am tring to run the batch form ant
Thanks 
Limor
-- 
View this message in context: http://old.nabble.com/Psexec-and-ant-tp28827734p28831643.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Psexec and ant

Posted by Michael Ludwig <mi...@gmx.de>.
[Psexec and ant]
Limor schrieb am 09.06.2010 um 02:07 (-0700):
> 
> Hello
> I'm trying to use Psexec by using ant with no success... 
> 
> ant task:
> <target name="myName" dir="." output="myOutput">  
>     <exec executable="psexec.exe" dir="${build.files}" >
>             <arg value="\\172.16.191.2"/>
>             <arg value="-u" />
>             <arg value="myUser" />
>             <arg value="-p" />
>             <arg value="myPass" />
>             <arg value="-c" />            
>             <arg value="runme2.bat" />    
>             <arg value="myValue" />      
>     </exec>  
> </target>
> 
> output is:

The output I snipped doesn't look like Ant output. Did you run Ant at
all? If so, you should have seen syntax errors for including "dir" and
"output" attributes in your <target>, which don't belong there.

See Ant manual: "Concepts and Types" > "Targets and Extension-Points"

-- 
Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org