Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Lets say i finished a Job and Export it as a Batch file.
Name myJob.bat
I put it in C:\Program Files\Talend
My Job get some Parameters from a .txt file and makes a SQL query on my DB and writes the results in a .csv.
They are located in the same Folder. Path is C:/Program Files/Talend/my.txt and C:/Program Files/Talend/my.csv
Everytime i move the Job to another Folder i have to Change the paths in my talend Job.
My question is: Is it possible to make some sort of subjob at the start of the Job that finds out in what Folder myJob.bat is located? If it's possible i can save this in a variable and pass it to the path for the .txt and .csv.
Then the path would look like pathvariable+/my.txt and pathvariable+/my.csv and i dont have to open the Job and Change path everytime.
I hope you understand what im searching for. Is it even possible?
Gabra wrote:
Hello,
Yes you can set a context variable in tJava component:
context.WorkDir = System.getProperty("user.dir");
This will get you the path for the dir that holds your .bat file.
Perfect,thanks!