Jump to content
Sign in to follow this  

How To Detect Cd Drive Automatically

Recommended Posts


Sorry again coz i weak in programming. Just beginner

i have a file in CD and i want open that file using GUI. Let's say the file name is file.pdf

The problem is, not all computer assign same character for CD Drive like in my laptop, it is E:\ and my Dekstop is I:\ and so on

Thus how to makesure when people press button in GUI, thus the computer know the CD drive and open that file. Tq

Share this post

Link to post
Share on other sites

maybe... put this first, change the use to PDF files

$var = FileOpenDialog($message, "C:\Windows\", "Images (*.jpg;*.bmp)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)


Edited by Valuater


Share this post

Link to post
Share on other sites


$file_relative_path = "myfolder\myotherfolder\myfile.pdf"
For $i = Asc('a') to asc('z')
   If DriveGetType ( Chr($i) & ":" ) = "CDROM" And DriveStatus ( Chr($i) & ":" ) = "READY" Then
       $drive = Chr($i)
If $drive="<not_known>" Then
   MSGBOX(0, "No CDROM found", 'Sorry =.="')
Run('run "'&drive&':\'&$file_relative_path&'"')


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.