Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
jensej
Creator
Creator

[resolved] Finding path of my .bat file

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?

 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

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.

View solution in original post

2 Replies
Anonymous
Not applicable

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.
jensej
Creator
Creator
Author

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!