Jump to content

Change working directory dynamically according to drive letter or drive label


Recommended Posts

Dear AutoIT forum,

I´m relatively new to AutoIT and don´t know if this is the right place to ask.

I have written a little script that silently deploys a software-product to multiple computers from our network-storage.

No issues so far with the installation itself, it works pretty seamless. But on multiple PCs simultaneously thats another story. The directory of the software is very large with a lot of smaller files (22,8 GB with over 75000 files) and I decided to create an ISO-file instead of the bare directory as well as copy it to the local harddisk before the installation starts.

Now the procedure has changed I need to separate the script from the software-product. No problem so far, but I am bit lost when it comes to accessing the mounted image now. The drive letter is not always the same, because possibly in some cases a user plugs in an USB-Device and Windows assigns another drive letter.

I already tried a lot of things and searched for hours, but now I realized that I need help.

How do I change the working directory dynamically according to the drive letter or drive label?

Thanks!

Link to comment
Share on other sites

You can use a unique file to determine which is the iso for example:
nb: DriveGetDrive Type CDROM should also return ISO images, it does on my system Windows 10 1709 64bit Enterprise Edition.

#include <Array.au3>

Local $aDrives = DriveGetDrive ("CDROM")
For $i = 1 To $aDrives[0]
    If FileExists($aDrives[$i] & "\setup.exe") Then MsgBox(32, "Setup Found", $aDrives[$i] & "\Setup.exe exists.")
Next

 

Link to comment
Share on other sites

7 hours ago, Earthshine said:

Have you considered using seven zip for applications and just making a zip file of your install directory?

I also tested that but with a good compression rate it is only about 2-3 GB smaller and with the extracting it almost takes twice as long. Copying bare directory or image = 7-8 min. Copying ZIP file and extract = 15 min. Something like that. I will post my current code if I updated it this week. Thanks so far.

Link to comment
Share on other sites

hey brah, check it. this looks EASY

Local $image = 'D:Software FullNew folderVS2010Express1.iso'; Disc Image To Load
;~ RunWait()
ShellExecute('C:Program FilesUltraISOdriversIsoCmd.exe', '-mount G: ' & '"' & $image & '"' )

You will need that software to mount the image, or similar image mounting software. From there you can do your sweet install script stuff that works.

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...