I have in the same folder a .bat and a .exe file.
I couldn't call the .exe file from the .bat unless I put the full absolute path to it.
Is there a way to don't specify the path?
views:
52answers:
2
                
                A: 
                
                
              seems odd? I haven't worked on windows for sometime but
did you try leading with a ./
./program.exe
really should be no difference? maybe the bat is executing from the context of C:\Windows or did your batch do any cd to another dir at some point?
                  house9
                   2010-04-28 15:07:50
                
              You meant .\  (that is, backslash).
                  Philip Kelley
                   2010-04-28 15:09:32
                I think that when I execute the batch it is being executed from another directory.
                  Jader Dias
                   2010-04-28 15:11:04
                Maybe my question is "how to double click a batch file and make it execute in the same directory as it is?"
                  Jader Dias
                   2010-04-28 15:11:45
                doh! yes you are right a backslash
                  house9
                   2010-04-28 15:17:20
                . is the current directory aka working directory and could be changed in a batch with cd and pushd.
                  Anders
                   2010-04-28 20:53:24
                
                +2 
                A: 
                
                
              Try calling the .exe with %~dp0, like this: %~dp0MyProgram.exe.
%0 contains the full path to the called .bat file.
~dp says to get the drive and path, including trailing \.
                  Patrick Cuff
                   2010-04-28 15:10:36
                
              +1 votejust found this link on google search - http://weblogs.asp.net/whaggard/archive/2005/01/28/get-directory-path-of-an-executing-batch-file.aspx
                  house9
                   2010-04-28 15:17:54