0

If I make a file foo.exe, and it contains the files bar.bat, baz.bat, and qux.bat, can I call baz.bat from within bar.bat? I mean, if bar.bat is the file that is executed upon execution of foo.exe?

user1938464
  • 127
  • 1
  • 6
  • 2
    How, exactly, does `foo.exe` contain these files? –  Jan 06 '13 at 23:15
  • Well, I use iexpress to compress them into `foo.exe`. – user1938464 Jan 06 '13 at 23:18
  • 1
    I'd expect IExpress to first extract all contained files, and then run your `bar.bat` in the target directory. I have no experience with IExpress itself, but have you just tried it? –  Jan 06 '13 at 23:24
  • I don't have too much experience with how it works, but I do use it often, as it is a very handy tool. – user1938464 Jan 06 '13 at 23:45

1 Answers1

1

I had done something similar using winrar (instead of iexpress) self extracting archive.

The mechanism is like below:

  1. First it will extract everything to specified folder (or in temporary folder %TEMP%/random_name)
  2. Then it will call initial executable/script or "script to run after extraction". In your case, it's bar.bat.
  3. That executable script can in turn call any other script/executable. (baz.bat in your example)

To be sure, change the file bar.bat to contain below script:

@echo off
cd
explorer .
pause

This will print the directory name, where it has extracted & open the directory with explorer.exe. Then you can verify that your baz.bat is in same directory. Give relative path, if required.

anishsane
  • 20,270
  • 5
  • 40
  • 73