How to run a shorcut,open a DOC file etc.? 
Author Message
 How to run a shorcut,open a DOC file etc.?

Sorry for my poor English
I want to "open" a file with Windows relation program,
Just like mouse double clik the icon in the desktop,
I use WinApi funtion shellex in VB 6.0
and I use these codes in wsh:

set wshshell=wscript.createobject("wscript.shell")
'start a shrocut
filename="c:\windows\desktop\vb6.lnk"
wshshell.run "start "&filename
'open a file with default program
filename="c:\samples.jpg"
wshshell.run "start "&filename

The codes work,but I must depend on a command file "start.exe"and display a
DOS-like box... Is there some
 better metho? Can anyone help me? Thanks.



Tue, 22 Jul 2003 11:43:30 GMT  
 How to run a shorcut,open a DOC file etc.?
The start.exe file is not needed to execute these commands. Try running them
directly. Note the triple quotes; they aren't really needed in the examples
below, but are neccessary if executing a file with spaces in its path.

set wshshell=wscript.createobject("wscript.shell")
wshshell.run  """c:\windows\desktop\vb6.lnk"""
wshshell.run """c:\samples.jpg"""

: Sorry for my poor English
: I want to "open" a file with Windows relation program,
: Just like mouse double clik the icon in the desktop,
: I use WinApi funtion shellex in VB 6.0
: and I use these codes in wsh:
:
: set wshshell=wscript.createobject("wscript.shell")
: 'start a shrocut
: filename="c:\windows\desktop\vb6.lnk"
: wshshell.run "start "&filename
: 'open a file with default program
: filename="c:\samples.jpg"
: wshshell.run "start "&filename
:
: The codes work,but I must depend on a command file "start.exe"and display
a
: DOS-like box... Is there some
:  better metho? Can anyone help me? Thanks.
:
:
:
:



Tue, 22 Jul 2003 19:06:42 GMT  
 How to run a shorcut,open a DOC file etc.?
Ah yes,I got it

Thank you Walter Zackery


Quote:
> The start.exe file is not needed to execute these commands. Try running
them
> directly. Note the triple quotes; they aren't really needed in the
examples
> below, but are neccessary if executing a file with spaces in its path.

> set wshshell=wscript.createobject("wscript.shell")
> wshshell.run  """c:\windows\desktop\vb6.lnk"""
> wshshell.run """c:\samples.jpg"""



Fri, 25 Jul 2003 09:59:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. how to open *.asp(code part)/*.doc or any other file in its original programm

2. open doc/excel file in frame with Word/Excel menubar

3. File open script within HTML doc

4. checking for an open app with wscript etc

5. open/run an EXE file from JavaScript/HTML

6. need help: Open Excel, run macro, save file, close Excel

7. Opening Word Doc inside IE frame

8. Saving multipage doc with Laserwriter 8.7 and opening with Ghostscript

9. Open Word w/doc from Jscript

10. Opening Word Doc inside an IE frame

11. Opening Word Doc

12. Opening a word doc in part of an html page

 

 
Powered by phpBB® Forum Software