Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Need help creating shortcuts

Reply
 
Old 07-31-2008   #1 (permalink)
Mike


 
 

Need help creating shortcuts

Hi everyone- this is an easy one I think, I just need a little help
due to being only a once-in-while vb scripter. I need to create some
shortcuts (.lnk files) and want to use vbscript to do it as it seems
pretty easy. I'm just having a few issues getting the
objLink.TargetPath to behave as I want it to.

1) When I put in forward slashes(/), the shortcut ends up with
backlashes (\)

2) I'm having trouble getting paths to 2 items with spaces in the path
to work properly.

Here are 2 examples of what I would like the Target Path to contain,
and cannot get to work properly.

1) "%PROGRAMFILES%\Internet Explorer\iexplore.exe" "C:\Program Files
\MyApp\TextFile.txt"

2) %systemroot%\explorer.exe /e, /root, \\server1\users\usershare

Any help on setting this up appreciated. Thanks...

My System SpecsSystem Spec
Old 07-31-2008   #2 (permalink)
Tom Lavedas


 
 

Re: Need help creating shortcuts

On Jul 31, 6:36*pm, Mike <thelotu...@xxxxxx> wrote:
Quote:

> Hi everyone- this is an easy one I think, I just need a little help
> due to being only a once-in-while vb scripter. I need to create some
> shortcuts (.lnk files) and want to use vbscript to do it as it seems
> pretty easy. I'm just having a few issues getting the
> objLink.TargetPath to behave as I want it to.
>
> 1) When I put in forward slashes(/), the shortcut ends up with
> backlashes (\)
>
> 2) I'm having trouble getting paths to 2 items with spaces in the path
> to work properly.
>
> Here are 2 examples of what I would like the Target Path to contain,
> and cannot get to work properly.
>
> 1) "%PROGRAMFILES%\Internet Explorer\iexplore.exe" "C:\Program Files
> \MyApp\TextFile.txt"
>
> 2) %systemroot%\explorer.exe /e, /root, \\server1\users\usershare
>
> Any help on setting this up appreciated. Thanks...
Old issue - mostly with MS documentation. Notably because the
shortcut method in WSH operates differently from the manual creation
of a shortcut.

The Targetpath property is just that - ONLY the path to the
executable. Arguments are provided with the Arguments property.

Tom Lavedas
===========
My System SpecsSystem Spec
Old 08-01-2008   #3 (permalink)
Pegasus \(MVP\)


 
 

Re: Need help creating shortcuts


"Mike" <thelotus99@xxxxxx> wrote in message
news:3bdef61f-cdbf-40ee-8060-74912861b1cb@xxxxxx
Quote:

> Hi everyone- this is an easy one I think, I just need a little help
> due to being only a once-in-while vb scripter. I need to create some
> shortcuts (.lnk files) and want to use vbscript to do it as it seems
> pretty easy. I'm just having a few issues getting the
> objLink.TargetPath to behave as I want it to.
>
> 1) When I put in forward slashes(/), the shortcut ends up with
> backlashes (\)
>
> 2) I'm having trouble getting paths to 2 items with spaces in the path
> to work properly.
>
> Here are 2 examples of what I would like the Target Path to contain,
> and cannot get to work properly.
>
> 1) "%PROGRAMFILES%\Internet Explorer\iexplore.exe" "C:\Program Files
> \MyApp\TextFile.txt"
>
> 2) %systemroot%\explorer.exe /e, /root, \\server1\users\usershare
>
> Any help on setting this up appreciated. Thanks...
Let's have a look at what you've got so far!


My System SpecsSystem Spec
Old 08-04-2008   #4 (permalink)
Mike


 
 

Re: Need help creating shortcuts

On Jul 31, 8:14*pm, Tom Lavedas <tglba...@xxxxxx> wrote:
Quote:

> On Jul 31, 6:36*pm, Mike <thelotu...@xxxxxx> wrote:
>
>
>
Quote:

> > Hi everyone- this is an easy one I think, I just need a little help
> > due to being only a once-in-while vb scripter. I need to create some
> > shortcuts (.lnk files) and want to use vbscript to do it as it seems
> > pretty easy. I'm just having a few issues getting the
> > objLink.TargetPath to behave as I want it to.
>
Quote:

> > 1) When I put in forward slashes(/), the shortcut ends up with
> > backlashes (\)
>
Quote:

> > 2) I'm having trouble getting paths to 2 items with spaces in the path
> > to work properly.
>
Quote:

> > Here are 2 examples of what I would like the Target Path to contain,
> > and cannot get to work properly.
>
Quote:

> > 1) "%PROGRAMFILES%\Internet Explorer\iexplore.exe" "C:\Program Files
> > \MyApp\TextFile.txt"
>
Quote:

> > 2) %systemroot%\explorer.exe /e, /root, \\server1\users\usershare
>
Quote:

> > Any help on setting this up appreciated. Thanks...
>
> Old issue - mostly with MS documentation. *Notably because the
> shortcut method in WSH operates differently from the manual creation
> of a shortcut.
>
> The Targetpath property is just that - ONLY the path to the
> executable. *Arguments are provided with the Arguments property.
>
> Tom Lavedas
> ===========
Hi Tom,

Thanks for the tip, that's exactly what I needed. I added
'objLink.Arguments' to my script and it's working fine now.

~Mike
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
creating shortcuts PowerShell
Creating desktop shortcuts Vista General
Creating shortcuts with PowerShell PowerShell
Creating shortcuts from PowerShell PowerShell
creating Startmenu-Shortcuts PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46