Announcement

Collapse
No announcement yet.

How can I refer to the "mount point" in a .bat file?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I refer to the "mount point" in a .bat file?

    Hello everybody, first post here.

    I would like to distribute a large archive by making an ISO image of it and mounting it with Daemon Tools.

    I then write a .bat file to "install" that archive properly.

    Here's my question: how can I "call" a file from within that mounted image in batch file?

    Let me explain:
    I mount the archive from my batch file with
    Code:
    daemon.exe -mount, 0 "<path>\image.iso"
    The virtual drive # to which the image is mounted will of course vary for each computer (= first free drive letter)
    Say I now want to access a particular file in that image.
    Code:
    <virtual drive>:\directory\file.exe
    How can I "find" that file, eg. how can I specify in my batch file which path I need to use?
    Is there a way to save the mount point <virtual drive> as a variable?

    I know that I could just add an autorun.inf file to my archive
    to launch a file but I only want this file to load at specific times, not each time I mount the archive in the future.

    I also tried looking using the registry to extract that value
    but couldn't figure it out...

    Thanks for any help you can give!

    PS: I would like a solution that works with Daemon Tools 3.47 if possible but if need be I will upgrade to the newest version.

  • #2
    Anyone?

    Is my post unclear or does nobody know?

    I'd appreciate an answer... thanks!

    Comment


    • #3
      Nevermind...

      I found I could do the trick by using

      Code:
      for %%a in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\<specific file in archive> set VIRTUALCD=%%a
      then simply call use the %VIRTUALCD% variable to call the file(s)

      It's not perfect - I must specify an uncommon filename to ensure
      that it won't call the wrong drive but it will do.

      I will just have to include a blank file with a really weird name in my archive!

      Thanks for nothing guys, I'm overwhelmed by the friendly responses I got.
      Maybe this will help somebody else as well.

      Comment


      • #4
        Would you prefer we all posted with "I don't know"? If we can't help you, what good does it do to post?

        Comment


        • #5
          Originally Posted by MCSmarties
          I found I could do the trick by using

          Code:
          for %%a in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\<specific file in archive> set VIRTUALCD=%%a
          then simply call use the %VIRTUALCD% variable to call the file(s)

          It's not perfect - I must specify an uncommon filename to ensure
          that it won't call the wrong drive but it will do.

          I will just have to include a blank file with a really weird name in my archive!

          Thanks for nothing guys, I'm overwhelmed by the friendly responses I got.
          Maybe this will help somebody else as well.
          First time I saw this, or I would have answered earlier... I've used a similar batch file as yours for other purposes, and it works, but if you don't want to bother with it, there is a much simpler way around the problem.

          Just always use the same drive letter for the mounted drive (say, drive Z. Of course, it wouldn't hurt to set an enviornment variable such as VIRTUALCD in case you need to change which drive you use, in case you can't use drive Z: on any one system (personally, I couldn't use Z:, because I always make Z: and Y: and my two optical drives, and start with W: and go down for my mounted drives... this way, I don't have as many headaches with drive lettering if I add or delete partitions later, especially on multi-boot systems).
          CLHatch
          To err is human... to really foul up requires a computer.

          Comment

          Working...
          X