ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <fzli...@omnytex.com>
Subject Re: Open a shell and run a batchfile
Date Sun, 14 Aug 2005 21:39:43 GMT
Hi Frank (from one Frank to another!),

I don't see any way to do that directly from Ant, but maybe someone else 
does.  Assuming there is no easy answer, here's one round-about way to 
pull it off...

Ant script:

   <project name="test" default="showdir">
     <target name="showdir">
       <exec executable="cmd.exe">
         <arg line="/c test.vbs" />
       </exec>
     </target>
   </project>

And test.vbs is:

   dirToList = "c:\"
   Set wshShell = WScript.CreateObject("WSCript.shell")
   wshshell.run "cmd.exe /k dir " & dirToList, 1, false
   Set wshshell = nothing

Change dirToList as appropriate, or passing it in as a command line 
argument would probably be even better (and I'd bet more appropriate 
since I'm guessing you want to determine what directory to list from the 
Ant script?) and you should be all set.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

Frank Schaare wrote:
> Hi,
> 
> i´d like to automate some tasks under Win 2000 Server. A dos box should 
> open and a batch file should be executed therwith the user can read the 
> batchfiles output.
> 
> There are tons of examples like this:
> <exec executable="cmd">
>     <arg line="/c test.bat" />
> </exec>
> 
> i´ve tried several mutations of these examples, but none of them opened 
> the expectet cmd-box for me.
> 
> In fact, tis topic should be FAQ, but i searched the arcives until 2000 
> without finding a suitable answer.
> 
> Is it possible to open a cmd-box in Win2K Server ? Do you know any 
> relatet threads, articles, sites etc which deal with this problem ?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 
> 
> 




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


Mime
View raw message