jeudi 26 février 2015

Generic batch command to access python script in another directory

I have the following .bat script which is located on the Desktop. I have a python script which resides in a folder ("Folder") also on the Desktop. I can run the .bat script if both files are on the same directory but how I can access the python script when it's in "Folder"? I want this to run on other computers so I am trying to avoid defining usernames (eg. C:\Users\user_name\Desktop) unless there is a generic way to obtain user names and incorporate that into the .bat file.


The following is the .bat script:



@echo off

rem Root OSGEO4W home dir to the following directory
call "C:\OSGeo4W64\bin\o4w_env.bat"

echo.
cmd /k python "Script.py"
@echo on


I tried inserting cd Folder before cmd /k python "Script.py but that only sets the directory and doesn't follow on to run the python script.


Any advice is appreciated!


Aucun commentaire:

Enregistrer un commentaire