|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Hi
I want to run a Batch file using os.system in Python. for ex: some installation batch file is there .. say install.bat I can call these function using os.system('install.bat') Now install.bat requires parameters.. say some source and destination ... that we can give using ... %s input 1 = source input2 = destination ex : os.system('c:/install.bat %s,%s'%(input1,input2)) This perfectly executes install.bat Now the problem is it wants inputs from the user... after starting the command... like [Yes(Y)/No(N)/All(A)] How can we give these inputs ? Note : I want to give the inputs like (y,n,a) after starting the execution of install.bat Please help me how to do this ! Iam badly in need of this... Help me .... Waiting for ur suggestions...... ![]() |
|
#2
|
||||
|
||||
|
You could try writing a list of the input responses to a separate file (say) commands.txt.
Then prepare your string like this: Code:
os.system('c:/install.bat %s,%s < %s'%(input1,input2, 'command.txt'))
The < tells it to read input from commands.txt instead of the command line. So whenever it needs to read some input, it will get it from commands.txt.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
Please check the url given below.
hxxp://i229.photobucket.com/albums/ee259/mohangbits/Picture1.jpg replace hxxp with http At 1 . the normal os.system() command starts At 2 and 3. the inputs we have to enter I tried with < %s ... its showing the same error.. ![]() |
|
#4
|
|||
|
|||
|
Hey Its working man !!
Thanks a lot ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Os.system() | Help Me |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|