Jump to content

Help Needed! Start a Command Prompt with CD to Path, Start Executable with parameters.


Go to solution Solved by Danp2,

Recommended Posts

Hello There,

Can someone please give an example how to do the below from AutoIT?

Start command prompt to CD to a specific path, from that specific path to start an executable with parameters. 

e.g. CMD > CD "C:\Program Files\MusicPlayer"

       CMD > MusicPlayer.exe "FirstParameter-SongDirectory" "SecondParameter-SongName" "ThirdParameter-StartPlayingFromSconds"

= MusicPlayer.exe "C:\Program Files\MusicPlayer\SongSelections" "Michael Jackson - Smooth Criminal.mp3" "10"

Thank you!

Link to comment
Share on other sites

Personally, I would prefer ShellExecute because of the "parameter" parameter.

ShellExecute("MusicPlayer.exe", "C:\Program Files\MusicPlayer\SongSelections\Michael Jackson - Smooth Criminal.mp3 10")

But if you really want to run it from command line, I think this would do it.

Run("cmd")
WinWaitActive("C:\Windows\SYSTEM32\cmd.exe")
Send('MusicPlayer.exe ' & '"' & 'C:\Program Files\MusicPlayer\SongSelections\Michael Jackson - Smooth Criminal.mp3 10' & '"')
Send("{ENTER}")

 

Link to comment
Share on other sites

12 hours ago, Pine99 said:

CMD > CD "C:\Program Files\MusicPlayer"

       CMD > MusicPlayer.exe "FirstParameter-SongDirectory" "SecondParameter-SongName" "ThirdParameter-StartPlayingFromSconds"

= MusicPlayer.exe "C:\Program Files\MusicPlayer\SongSelections" "Michael Jackson - Smooth Criminal.mp3" "10"

Maybe this?

ShellExecute('MusicPlayer.exe', '"C:\Program Files\MusicPlayer\SongSelections" "Michael Jackson - Smooth Criminal.mp3" "10"', 'C:\Program Files\MusicPlayer')

 

Link to comment
Share on other sites

15 hours ago, Pine99 said:

Hello There,

Can someone please give an example how to do the below from AutoIT?

Start command prompt to CD to a specific path, from that specific path to start an executable with parameters. 

e.g. CMD > CD "C:\Program Files\MusicPlayer"

       CMD > MusicPlayer.exe "FirstParameter-SongDirectory" "SecondParameter-SongName" "ThirdParameter-StartPlayingFromSconds"

= MusicPlayer.exe "C:\Program Files\MusicPlayer\SongSelections" "Michael Jackson - Smooth Criminal.mp3" "10"

Thank you!

Thank you (and for everyone else who replied)

I managed to do it (had to play around with the quotation marks a bit but it's working) :)

e.g.

$runMPE = Run('"C:\Program Files\MusicPlayer\SongSelections\MusicPlayer.exe" "Michael Jackson - Smooth Criminal.mp3" "10"')

 

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...