## batch file not working totally correct.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
TheTagStag
Posts: 2
Joined: 09 Jan 2017 07:20

### batch file not working totally correct.

I have created a batch file linked to a pdf file. The aim is that when you click the link on the pdf it will open the batch file which in turn will open a 360 image software which will then open the image itself.
If i write the batch file like this

"path to software" "path to image"

it works perfectly.
However I do not have a fixed "path to image". rather I have a folder structure like this.
Main folder>pdf and two other folders, one named executables and one named images, with the batch file located in the executables folder and the images to be open in the images folder.

So I have written the batch file as follows:

"path to software" "..\images\imagenumber.jpeg"

Here the software opens but the image does not and I cant figure out why. If i make a batch file as such

"..\images\imagenumber.jpeg"

It can open the image alone, but for some reason coupling this with viewing software just seems to stop it at its tracks.

Any theories?

kwsiebert
Posts: 21
Joined: 20 Jan 2016 15:46

### Re: batch file not working totally correct.

When your batch is launched from another process (the PDF software in this case), the active directory it runs from will be whichever one the launching process was using. You will either need to use an absolute path to your image, or have the batch explicitly change to a known directory.

TheTagStag
Posts: 2
Joined: 09 Jan 2017 07:20

### Re: batch file not working totally correct.

kwsiebert wrote:When your batch is launched from another process (the PDF software in this case), the active directory it runs from will be whichever one the launching process was using. You will either need to use an absolute path to your image, or have the batch explicitly change to a known directory.

In that case how can I launch a batch file as follows

"..\images\R0010337.jpg"

from the pdf and it will open the image from the correct directory.