Deex
Deex

Reputation: 327

start an exe with bat and it's own location

Okay this is my ToolChain setup:

  1. I got a bat script that is calling a further bat script
  2. The second bat script is calling an .exe which is performing autoit's on a software like starting, saving and closing.

In other words: bat > bat > exe (AutoIt) > exe (a Parser)

Okay here is the issue, the software (Parser) that will be started at least is some kind of weird, it won't find important files, if it's not being started from the same directory.

So as example if i put my autoit .exe or my .bat file into the directory of the software and start it - all is fine. But if i move my exe or my bat scripts outside of the directory and call it, it won't find files to start working.

For exactly this reason i made a second bat file and tried to set the path (set PATH=%PATH%;D:/filetype/dbcparser/) but that didn't have any effect on my case; if i call every bat or exe file not from the directory, it won't work correctly.

I hope someone found something like this before and could give me a hint for a workaround.

Upvotes: 0

Views: 200

Answers (1)

Peter Badida
Peter Badida

Reputation: 12169

I was in the same situation, but using cd before start worked for me(whole file):

@echo off
cd "<start here>"
start "" call "<start here>your.bat"

also if you have PATH problems, try even this:

@echo off
cd "<start here>"
set PATH=<something>;%PATH%
start "" call "<start here>your.bat"

Upvotes: 1

Related Questions