Sign in to follow this  
Followers 0
GioVit

Open a file with it's associated program

7 posts in this topic

I need to know how can I open a file (with extension .exe, .doc, .txt, .htm, etc) with it's associated program (Excel, Word, Notepad, Internet Explorer, etc) I tried with this

Run(@ComSpec & " /c start " & $file, @SW_SHOW)

but it only work witn Internet Explorer.

Is there a more generic way to do this? without knowing the program associated to the file I want to open.

thanks in advance

Share this post


Link to post
Share on other sites



I need to know how can I open a file (with extension .exe, .doc, .txt, .htm, etc) with it's associated program (Excel, Word, Notepad, Internet Explorer, etc) I tried with this

Run(@ComSpec & " /c start " & $file, @SW_SHOW)

but it only work witn Internet Explorer.

Is there a more generic way to do this? without knowing the program associated to the file I want to open.

thanks in advance

Try _RunDos

#include <Process.au3>
$rc = _RunDos("start d:\autoit\uptime.au3")


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Try _RunDos

#include <Process.au3>
$rc = _RunDos("start d:\autoit\uptime.au3")
I Found that the problem is with Directories or filenames that has space in its names, so I can solve the directories problem executing the function FileChangeDir() previously and then excute _RunDos() but I still have problem with filenames that has spaces. I Tried adding quotation but doesn't work:

$rc = _RunDos('"start d:\autoit\up time.au3"')

Or

$rc = _RunDos('start "d:\autoit\up time.au3"')

Any suggestion

Share this post


Link to post
Share on other sites

I Found that the problem is with Directories or filenames that has space in its names, so I can solve the directories problem executing the function FileChangeDir() previously and then excute _RunDos() but I still have problem with filenames that has spaces. I Tried adding quotation but doesn't work:

$rc = _RunDos('"start d:\autoit\up time.au3"')

Or

$rc = _RunDos('start "d:\autoit\up time.au3"')

Any suggestion

Try

#include <Process.au3>
$prog = FileGetShortName("d:\autoit\up time.au3")
$rc = _RunDos("start " & $prog)


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Try

#include <Process.au3>
$prog = FileGetShortName("d:\autoit\up time.au3")
$rc = _RunDos("start " & $prog)
Many Thanks BigDog, it works now

Many thanks also to all the peoples that colaborates in Autoit forum

Share this post


Link to post
Share on other sites

Many Thanks BigDog, it works now

Many thanks also to all the peoples that colaborates in Autoit forum

The name is BigDod not BigDog but we all make typos.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

The name is BigDod not BigDog but we all make typos.

I'm really sorry but you are Big (Great) anyway!

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