Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
parpatra
Partner - Contributor III
Partner - Contributor III

Use relative path in batch script

Hi,

I have a requirement where I need to execute the same batch script from my DEV environment and then also from the PRODUCTION environment. Can you please suggest me as how I should do this?

Ex:

DEV folder: C:\DEV\

Script location: C:\DEV\SCRIPT\

QVW location: C:\DEV\QVW\

PROD folder:C:\PROD\ 

Script location: C:\PROD\SCRIPT\

QVW location: C:\PROD\QVW\

Thanks

Partha

5 Replies
Miguel_Angel_Baeyens

Hi,

If you mean you need to run the same QVW in two different folders without changing the folder name, you can use an include file, named "include.qvs" that is in the same folder where the QVW is. So there will be two "include.qvs" files each with the correspoding environment locations, for example for the development environment:

SET vFolder = 'C:\DEV\';

SET vScriptFolder = 'C:\DEV\SCRIPT\';

SET vQVWFolder = 'C:\DEV\QVW\';

You can write this using notepad or any other plain text editor. Then, in the script, you call this like

$(include=include.qvs);

So you don't need to change the folder each time you move the file.

Hope that helps.

Miguel

parpatra
Partner - Contributor III
Partner - Contributor III
Author

Thanks Miguel, But I am executing a batch script to reload my QVW, So wanted to do a 2 line code in the .bat script as following:

Cd ../QVW

<Reload statement>

Now I am getting error for the 1st statement while triggering it for 'external programs' under supporting tasks in QEMC.

So wanted to know if this is a QV limitation?

My main aim is use a relative path in the batch scipt  as my QVW and bat file are in different folders.

Miguel_Angel_Baeyens

Hi,

Use instead the reload statement in one single line for each reload, for example:

"C:\Program Files\QlikView\qv.exe" /r "D:\DEV\QVW\File.qvw"

Note the double quoting in both the path for the qv.exe and the qvw file.

Hope that helps.

Miguel

parpatra
Partner - Contributor III
Partner - Contributor III
Author

Thanks again...

But I really want to do "C:\Program Files\QlikView\qv.exe" /r "File.qvw"

I do not want to give a path name to the document file.

This is the extract from the QV reference manual:

"The path is the path to the file, either absolute, or relative to the current directory."

So my question is how can I use the document path as a relative path? The .bat file when has a relative path cannot be triggered from a external program under supporting tasks in QEMC.

Again thanks for trying to help me.

Miguel_Angel_Baeyens

Hi,

Assuming the paths in previous posts, if you do really need to use relative paths, then the command line should look like this one still:

"C:\Program Files\QlikView\qv.exe" /r "D:\DEV\QVW\File.qvw"

The reason why this must be like this is that the File to be loaded is in a different drive (D) so you need to change to drive D. Since there is no way to change using "..\..\", and since you need to specify the routes to both the qv.exe executable file and the QVW file, you need to specify this.

Hope that helps.

Miguel