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:41:52 GMT
Ah, sorry about that, I must have been half asleep... for some reason I 
thought you were asking to list a directory, now I see you want to run 
an arbitrary batch file.  Sorry, my bad.

However, I think what I posted still works just the same... just alter 
what's in test.vbs to execute, instead of "dir" it's your batch file... 
I'm almost completely certain that will work exactly the same.

Frank

Frank W. Zammetti wrote:
> 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


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


Mime
View raw message