Now I want to run them in jscript.
Who can tell me how to do?
Hi
Sadly, WScript.Shell's Run method has some issues with .lnk files unless
you use "%comspec% /c" or "rundll32.exe url.dll,FileProtocolHandler":
VBScript code, launch lnk files from script:
'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")
oShell .Run "%comspec% /C ""c:\my test\program.lnk""", 0, False
' or
oShell .Run _
"rundll32.exe url.dll,FileProtocolHandler ""c:\my test\program.lnk""" _
, 0, False
'--------------------8<----------------------
More here:
From: Gurgen (gur...@bellatlantic.net)
Subject: Re: Best way to execute a program from a vbs or wsf file
Newsgroups: microsoft.public.scripting.vbscript
http://groups.google.com/groups?selm=wuwc9.10178%24VW5.7317%40nwrddc02.gnilink.net
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
Try this.
var objShell = new ActiveXObject("Shell.Application");
var objFolder;
var objFile;
var ssfDesktop = 0;
objShell = new ActiveXObject("Shell.Application");
objFolder = objShell.NameSpace(ssfDesktop);
objFile = objFolder.ParseName("MyShortcut.lnk");
objFile.InvokeVerb();
--
Miyahn (Masataka Miyashita) JPN
Microsoft MVP (Office Systems - Excel)
HQF0...@nifty.ne.jp
However, I found that shortcut extension usually vary with its type.
For instance, generally shortcut has 'lnk' extension, but internet shortcut
has 'url' extension.
It's annoyed.
And also i found another problem.
I created a shortcut to a jpeg file.
MSPaint program will be launched when I click it.
But my script can't do this.
// script
var shell = WScript.CreateObject( "Shell.Application" );
var ssfDesktop = 0x0;
var folder2 = shell.NameSpace( ssfDesktop );
var shortcut = folder2.ParseName( "jpg.lnk" );
shortcut.InvokeVerb();
Why?
"Miyahn" <HQF0...@nifty.ne.jp> wrote in message
news:Orp$GqdtEH...@TK2MSFTNGP15.phx.gbl...
> Thanks.
>
> However, I found that shortcut extension usually vary with its type.
> For instance, generally shortcut has 'lnk' extension, but internet
> shortcut has 'url' extension.
>
> It's annoyed.
>
> And also i found another problem.
>
> I created a shortcut to a jpeg file.
> MSPaint program will be launched when I click it.
>
> But my script can't do this.
>
> // script
> var shell = WScript.CreateObject( "Shell.Application" );
> var ssfDesktop = 0x0;
> var folder2 = shell.NameSpace( ssfDesktop );
> var shortcut = folder2.ParseName( "jpg.lnk" );
> shortcut.InvokeVerb();
>
> Why?
Hi
Does it work if you use the rundll32.exe url.dll,FileProtocolHandler
method (see my other post in this thread)?
Probably, the target file is actually a bitmap file with wrong
extension.
How about this ?
shortcut.InvokeVerb("Open")
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:OF5Blc1t...@TK2MSFTNGP15.phx.gbl...
"Miyahn" <HQF0...@nifty.ne.jp> wrote in message
news:uQ5LGF3t...@TK2MSFTNGP10.phx.gbl...