Sign in to follow this  
Followers 0
Guest cjschrattenthaler

How to get the actual drive letter?

5 posts in this topic

Hi!

Is it possible to get the drive letter from the drive the EXE file is run?

Because, I want to create a CD-Menu, and I want to open the Windows Explorer for "Search CD-Rom...", and I want link the user directly to the CD-Rom drive, and not only start the Explorer.

Thanks,

Christian.

Share this post


Link to post
Share on other sites



Hi!

I found a working solution:

Create a script file "starte_WindowsExplorer.au3":

***

; AutoIt Version: 3.0

; Author: Christian-Josef Schrattenthaler

; Beschreibung: Dieses Script ermittelt das aktuelle Laufwerk, und startet anschließend den Windows-Explorer.

; Aktuelles Laufwerk ermitteln:

$aktuellesLaufwerk = StringLeft(@ScriptDir, 3)

; Windows-Explorer starten:

Run("Explorer.exe /e," & $aktuellesLaufwerk)

; Ende.

***

Compile Script to .exe

Create a "fscommand" folder in the same folder as the flash file is.

Copy the AutoIt .exe file in this folder.

Now you can call the AutoIt .exe file over "fscommand("exec","starte_WindowsExplorer");" in the flash file.

Greetings,

Christian.

Share this post


Link to post
Share on other sites

Take a look at the command DriveGetDrive as well.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

Func FindCD()

$abc = ""

$found = 0

For $i = 65 To 90

$abc = Chr($i) & ':\'

$cdr = DriveGetType($abc)

If $cdr = 'CDROM' Then $found = 1

Return $abc

endIf

Next

If $found = 0 Then

Return 'false'

EndIf

EndFunc ;==>FindCD

;Or

$driveletter = stringleft(@scriptdir, 2)

Share this post


Link to post
Share on other sites

Take a look at the command DriveGetDrive as well.

<{POST_SNAPBACK}>

As Nutster said this works just as well, this is from the help file

$var = DriveGetDrive( "CDROM" )
If NOT @error Then
    MsgBox(4096,"", "Found " & $var[0] & " drives")
    For $i = 1 to $var[0]
        MsgBox(4096,"Drive " & $i, $var[$i])
    Next
EndIf

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0