Hi,
You may also want to try something like:
test.bat:
@echo off
echo Starts batch file
dir
echo Ends batch file
test.py:
import os
os.system('test')
And run: jython test.py
Regards,
Andre
Email an...@bu...
Web http://www.burgaud.com
-----Original Message-----
From: jyt...@li...
[mailto:jyt...@li...] On Behalf Of Bent
Andre Solheim
Sent: Tuesday, August 05, 2003 5:51 AM
To: sp...@ma...; jyt...@li...
Subject: RE: [Jython-users] Execute a batch file from Jython script
Hi Sachin,
You can still use Runtime.exec from Jython:
###
from java.io import *
import java.lang.Runtime as Runtime
r = Runtime.getRuntime()
p = r.exec("ls -al")
i = p.getInputStream()
isr = InputStreamReader(i)
br = BufferedReader(isr)
s = br.readLine()
while s:
print s
s = br.readLine()
###
hope this helps! :)
regards
/Bent
> -----Original Message-----
> From: jyt...@li...
> [mailto:jyt...@li...] On Behalf
> Of Sachin G. Pawar
> Sent: 5. august 2003 11:35
> To: jyt...@li...
> Subject: [Jython-users] Execute a batch file from Jython script
>
>
> Hi All,
>
> How can I execute a batch file from a jython script?
>
> I am looking for a functionality similar to Runtime().exec(
> "cmd" ) which is available in Java.
>
> Thanks & Regards
> Sachin G. Pawar
>
> *********************************************************
> Disclaimer
>
> This message (including any attachments) contains
> confidential information intended for a specific
> individual and purpose, and is protected by law.
> If you are not the intended recipient, you should
> delete this message and are hereby notified that
> any disclosure, copying, or distribution of this
> message, or the taking of any action based on it,
> is strictly prohibited.
>
> *********************************************************
>
> Visit us at http://www.mahindrabt.com
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites
> including Data Reports, E-commerce, Portals, and Forums are
> available now. Download today and enter to win an XBOX or
> Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet
_072303_01/01
_______________________________________________
Jython-users mailing list
Jyt...@li...
https://lists.sourceforge.net/lists/listinfo/jython-users
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01
/01
_______________________________________________
Jython-users mailing list
Jyt...@li...
https://lists.sourceforge.net/lists/listinfo/jython-users
|