Saturday, December 5, 2009

Batch Run Python Run Python From Batch File?

Run Python from Batch File? - batch run python

I have run a simple Python file "script.py" Search for a location for a specific text on this file to the command prompt, type open:

Change is cd C: \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ file "/ / of the directory where the script
"Script.py Python" / / gives me the invitation to the site name with the text I'm typing in the search followed

Then I type:

script.py "www.google.com", "images"

The Google.com search for the text "image" and gives me a reading of the text if found. Works great. But wan't to run a batch file to use to do the same, so you do not write this in the CMD for the word "pictures" on Google. I can not work, the batch file, even if correct. Ideas?

2 comments:

blessed_... said...

I'm running Linux, so I must remember how Windoze box. I think the name of the script:

script.pyw

Double-clicking opens a Python shell, without prompting. In this way, you do not have cd C: \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ folder [not 100% sure of] this part

The python should
import os, sys

# Define two string values as a tuple
Values = ( 'www.google.com', 'Pictures')
# Or a value as a string

code = "% s photos script.py"

# The tuple in the chain code is
What the # os.system accept the string as a command in the terminal
(Code values os.system%)

blessed_... said...

I'm running Linux, so I must remember how Windoze box. I think the name of the script:

script.pyw

Double-clicking opens a Python shell, without prompting. In this way, you do not have cd C: \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ folder [not 100% sure of] this part

The python should
import os, sys

# Define two string values as a tuple
Values = ( 'www.google.com', 'Pictures')
# Or a value as a string

code = "% s photos script.py"

# The tuple in the chain code is
What the # os.system accept the string as a command in the terminal
(Code values os.system%)

Post a Comment