0

Most installs unpack to a temp folder. Is there a variable that holds the directory from which a SFX was launched, that can be subsequently used in a script operating from/in the temp folder?

A broader scope of this problem is I would like to simplify the procedure of mounting an .iso which has an autorun inside, for users unfamiliar with iso in general. The iso is fairly large in size and it must be independant from an assistant executable which I'd like to distribute alongside the .iso, which when clicked does the following: 1. Installs virtual drive software (so far IMDisk because its free, universal, lightweight and silent install/uninstall) 2. Mounts the iso (that adjacent to the proposed exectuable) 3. Launches autorun.exe within the iso image that is now loaded on the the newly created virtual drive.

Currently an SFX extracts to temp, silently installs the virtual drive software contain therein. Seperately I have a .cmd script also adjacent to the iso. that mounts the ISO.

The process is easy seperate; the inital working directory in cmd is exectution directory (that of iso), thus can be used with the code in the cmd that needed to mount the iso.

However I would like to consolidate the two actions, the SFX and the .cmd into a single action / icon so to simplify it all.

The iso and 'proposed exe' may be in any directory, so one cannot exactly be specific in the script that is launched in the temp folder - which is why I feel it would be handy knowing if theres possibly a variable that is stored that notes the directory from which the SFX is luanched which one can then use in subsequent scripts enacted by the SFX.

Sorry if this question is loaded i did my best!

shorterxp
  • 19
  • 1
  • Yes if you write your own SFX, at least in Windows, then your SFX passes it to the script as a command line argument. Otherwise it depends on who wrote the SFX builder. Search "get executable path" or similar for Windows if you're writing the SFX. If you are using a specific installer like InstallShield (script or MSI?), WIX, etc. then you need to tell us that. – Dave S Jun 09 '19 at 03:57
  • Thanks I now know the correct terminology is 'executable path'and I shall research it. I am amatuer but SFX and the GUI provided by winrar is excellent. SFX is the only way I am aware I thought would be suitable for this broader 'problem'. I'm open to suggestions re: autoloading ISOs but I'm confident the way I've desribed is the simplest, especially considering IMDisk does not require a reboot for which i'm thankful. – shorterxp Jun 09 '19 at 04:01
  • You might need to write your own executable for the SFX in C++ or another native language if WinRAR's SFX is not able to pass the SFX executable path to a script it runs. For unzipping you can use the free open source ZLIB library. – Dave S Jun 09 '19 at 04:04
  • I'm not committed to learning C++ just for this but thanks nevertheless. – shorterxp Jun 09 '19 at 04:08

1 Answers1

0

I finally found a way to do this, while working on a newer project... Basically one can use Bat to Exe converter v3.2, which explicitly allows user to specify working directory. It has the provision to embed files, much like how a SFX contains files.

shorterxp
  • 19
  • 1