Sign in to follow this  
Followers 0
earl82

CD-ROM command

8 posts in this topic

Hey does any one know what the command is to run an .exe file on the CD-ROM no matter what the drive letter is. I can't figure it out.

Any help will be appreciated. Thanks and GOD Bless.

Share this post


Link to post
Share on other sites



If the script is on the drive, you would just run from the current directory, however if not, i do not believe it is possible, sorry.


[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:
%programfiles%/AutoIt3/autoit3.chm

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Give something like this a try

; let's say your executable is in {CDROM-drive}\myfolder\myexe.exe
$myexe = "\myfolder\myexe.exe"
$drives = DriveGetDrive("CDROM")
If $drives = "" Then 
    MsgBox(0, "Error", "no CD/DVD drives found !")
Else    
   $found = False
   For $i = 1 To $drives[0]
    Local $fp = $drives[$i] & $myexe
    If FileExists($fp) Then
            Run($fp)
            $found = True
            ExitLoop
    EndIf
   Next
   If Not $found Then MsgBox(0, "Error", $myexe & " not found on any of your " & $drives[0] & " CD/DVD drives")
 EndIf

Note: not tested - don't have an optical drive available

hope that helps,

whim

Edited by whim

Share this post


Link to post
Share on other sites

Give something like this a try

; let's say your executable is in {CDROM-drive}\myfolder\myexe.exe
$myexe = "\myfolder\myexe.exe"
$drives = DriveGetDrive("CDROM")
If $drives = "" Then 
    MsgBox(0, "Error", "no CD/DVD drives found !")
Else    
   $found = False
   For $i = 1 To $drives[0]
    Local $fp = $drives[$i] & $myexe
    If FileExists($fp) Then
            Run($fp)
            $found = True
            ExitLoop
    EndIf
   Next
   If Not $found Then MsgBox(0, "Error", $myexe & " not found on any of your " & $drives[0] & " CD/DVD drives")
 EndIf

Note: not tested - don't have an optical drive available

hope that helps,

whim

Thanks I will give this a try when I get home.

Share this post


Link to post
Share on other sites

When doing things like this always make sure to include a few checks along the way so you can at least make the script exit gracefully.

Opt("MustDeclareVars", 1)
Local $aDrives = DriveGetDrive("cdrom")
If NOT @Error Then
    For $Drive in $aDrives
        If IsNumber($Drive) OR DriveStatus($Drive) <> "ready" Then ContinueLoop
        If NOT FileExists($Drive & "\setup.exe") Then ContinueLoop
        ShellExecute($Drive & "\setup.exe")
    Next
EndIf

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I am new to Autoit though I have registered few months back but I am more concered about customizing OS' acutally I am looking for a script which first look for the removable drive if found it runs a "myexe.exe" which is in "myfolder" and if the removable drived is not found it go on to search for CDROM and run the same exe in the same folder without giving any msg and without showing any window or so.

I have done this so far:

$var = DriveGetDrive( "CDROM" )
If not @error Then
For $i = 1 to $var[0]
Run($var[$i] & "myfolder\myexe.exe")
Next
EndIf

Please someone help me out.

Edited by niceguy75

Share this post


Link to post
Share on other sites

I am new to Autoit though I have registered few months back but I am more concered about customizing OS' acutally I am looking for a script which first look for the removable drive if found it runs a "myexe.exe" which is in "myfolder" and if the removable drived is not found it go on to search for CDROM and run the same exe in the same folder without giving any msg and without showing any window or so.

I have done this so far:

$var = DriveGetDrive( "CDROM" )
If not @error Then
For $i = 1 to $var[0]
Run($var[$i] & "myfolder\myexe.exe")
Next
EndIf

Please someone help me out.

I do not find any problem, the script should run....by the way which os are you using, friend ??

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Are you sure that DriveGetDrive( "CDROM" ) is correct?. Try with DriveGetDrive("Removable")


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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