calling a batch from within a batch without knowing the path

Discussion in 'Scripting' started by AdminKen, Sep 26, 2004.

  1. AdminKen

    AdminKen Guest

    I am writing some batch file that call other batch files or executables.
    They will all go in the same directory. These might be run from a, floppy, a
    CD, C drive, D drive, E drive or a files server, who knows. Could be
    anywhere. So, how do I call another program if I don't know what its path
    will be?

    Is there some syntax that specifies a call to the same directory that I am
    already running from? If I use ./ then that just refers back to the
    directory that the command window is focused on. right? so that's no help.

    thanks
    Ken
     
    AdminKen, Sep 26, 2004
    #1
    1. Advertisements

  2. AdminKen

    Sameh Ahmed Guest

    use a relative path
    \exe.exe
     
    Sameh Ahmed, Sep 26, 2004
    #2
    1. Advertisements

  3. AdminKen

    AdminKen Guest

    Will this work if the script is kicked off from a UNC path?

    Or if the script is started from a CD?
     
    AdminKen, Sep 27, 2004
    #3
  4. AdminKen

    Sameh Ahmed Guest

    as long as you maintain the same directory structure, it will make no
    difference to run it from wherever
     
    Sameh Ahmed, Sep 27, 2004
    #4
  5. AdminKen

    AdminKen Guest

    I screwed up, I was running that script from a UNC path. It seemed like it
    should have worked as I had everything in the same directory and did not have
    any path listed. I thought I was going nuts. In the case of a UNC the command
    shell defaults to c:\winnt or c:\windows
    Never mind.

    thanks for the help anyway.
     
    AdminKen, Sep 29, 2004
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.