|
Answer» I have downloaded the Python script from Google that generates a sitemap, and I'd like to automate the process with a batch file. However, my batching skills are limited to echo and ping.
BASICALLY, I need to create a batch file that changes the directory to and then runs the command "python sitemap_gen.py --config=config.xml"
All of this is doable in the command prompt, but it takes quite a few keystrokes. How do I do this?
-rockA batch file is basically one or more COMMANDS that run at the command line. So you enter the same commands that you would do from the command prompt. The batch file you want is probably something like: Code: [Select]@echo off cd \directory python sitemap_gen.py --config=config.xmltried that and it didn't seem to work.
The file I had going was very similar to what you've posted, but I changed it just in case.
The results, however, are identical: The black command prompt window opens, but nothing happens and it closes again. I've checked the sitemap.xml file to see when it was created and it hasn't changed since I did it manually a few hours ago.
Is there some WAY to see what the batch file is doing behind the scenes?
(leave echo on? It still didn't work.)
Code: [Select]@echo off cd d:\tom\web\site\htdocs\scripts\map\ python sitemap_gen.py --config=config.xml dunno what's wrong.Are you running this from C: or from D:? I assume PYTHON is in your path? And that sitemap_gen.py is in d:\tom\web\site\htdocs\scripts\map? You can try this in case it is a drive letter issue: Code: [Select]@echo off cd /d d:\tom\web\site\htdocs\scripts\map python sitemap_gen.py --config=config.xmlI'm running the script from C:, although I could put it in D: and just make an accessible shortcut. My windows/software HD is C:, my data HD is D:
However, they are both on the same Physical drive.
That didn't work. I MAY just scrap this and put up with the couple lines of typing every time. It's not like I NEED a new sitemap every time I add a file, but it'd be nice.
Thanks for the help, if you have any more ideas, I'm open.....
-rockTo see what is going on before the command prompt closes, try this: Code: [Select]@echo off cd /d d:\tom\web\site\htdocs\scripts\map python sitemap_gen.py --config=config.xml pauseLet us know what you get.sorry about the gigantic bump, but I thought I'd let people know that I got this to work
here's the .bat file Code: [Select]@echo E: cd e:\python25 python d:\tom\web\site\htdocs\scripts\map\sitemap_gen.py --config=d:\tom\web\site\htdocs\scripts\map\config.xml
That's it. Runs without errors. I must've been a real batching n00b back then .
thanks for your help
-rock
|