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

Vista - Creating shortcuts with PowerShell

Reply
 
Old 08-13-2007   #1 (permalink)
greatbarrier86


 
 

Creating shortcuts with PowerShell

Hi,

is it possible to use Powershell to create a desktop shortcut icon to one of
my company's programs. right now, i'm using a VB script to do it,but it would
be better if i could get Powershell to do it.

My System SpecsSystem Spec
Old 08-13-2007   #2 (permalink)
Desmond Lee


 
 

RE: Creating shortcuts with PowerShell

Yes. Take a look at a previous post if this helps.

http://www.leedesmond.com/weblog/?p=60

Thanks.
--
http://www.leedesmond.com/weblog/



"greatbarrier86" wrote:

> Hi,
>
> is it possible to use Powershell to create a desktop shortcut icon to one of
> my company's programs. right now, i'm using a VB script to do it,but it would
> be better if i could get Powershell to do it.

My System SpecsSystem Spec
Old 08-13-2007   #3 (permalink)
greatbarrier86


 
 

RE: Creating shortcuts with PowerShell

Desmond

Thanks...but it still is slightly confusing to me. I think i can get it

Thanks!!

"Desmond Lee" wrote:

> Yes. Take a look at a previous post if this helps.
>
> http://www.leedesmond.com/weblog/?p=60
>
> Thanks.
> --
> http://www.leedesmond.com/weblog/
>
>
>
> "greatbarrier86" wrote:
>
> > Hi,
> >
> > is it possible to use Powershell to create a desktop shortcut icon to one of
> > my company's programs. right now, i'm using a VB script to do it,but it would
> > be better if i could get Powershell to do it.

My System SpecsSystem Spec
Old 08-13-2007   #4 (permalink)
Desmond Lee


 
 

RE: Creating shortcuts with PowerShell

Give it a go and let us know if we could be of further help.


Thanks greatbarrier86.

--
http://www.leedesmond.com/weblog/



"greatbarrier86" wrote:

> Desmond
>
> Thanks...but it still is slightly confusing to me. I think i can get it
>
> Thanks!!
>
> "Desmond Lee" wrote:
>
> > Yes. Take a look at a previous post if this helps.
> >
> > http://www.leedesmond.com/weblog/?p=60
> >
> > Thanks.
> > --
> > http://www.leedesmond.com/weblog/
> >
> >
> >
> > "greatbarrier86" wrote:
> >
> > > Hi,
> > >
> > > is it possible to use Powershell to create a desktop shortcut icon to one of
> > > my company's programs. right now, i'm using a VB script to do it,but it would
> > > be better if i could get Powershell to do it.

My System SpecsSystem Spec
Old 08-13-2007   #5 (permalink)
greatbarrier86


 
 

RE: Creating shortcuts with PowerShell

Desmond,

I'm lost...i apologize.

Perhaps you could give me some help

I'd like to put a shortcut on the C:\Users\Public\Desktop location pointing
to C:\CPS\CPSAPP.exe

Could you perhaps write that for me? At least then, i would understand it
for future scripts.

"Desmond Lee" wrote:

> Give it a go and let us know if we could be of further help.
>
>
> Thanks greatbarrier86.
>
> --
> http://www.leedesmond.com/weblog/
>
>
>
> "greatbarrier86" wrote:
>
> > Desmond
> >
> > Thanks...but it still is slightly confusing to me. I think i can get it
> >
> > Thanks!!
> >
> > "Desmond Lee" wrote:
> >
> > > Yes. Take a look at a previous post if this helps.
> > >
> > > http://www.leedesmond.com/weblog/?p=60
> > >
> > > Thanks.
> > > --
> > > http://www.leedesmond.com/weblog/
> > >
> > >
> > >
> > > "greatbarrier86" wrote:
> > >
> > > > Hi,
> > > >
> > > > is it possible to use Powershell to create a desktop shortcut icon to one of
> > > > my company's programs. right now, i'm using a VB script to do it,but it would
> > > > be better if i could get Powershell to do it.

My System SpecsSystem Spec
Old 08-13-2007   #6 (permalink)
Desmond Lee


 
 

RE: Creating shortcuts with PowerShell

$wshshell = New-Object -ComObject WScript.Shell
$lnk = $wshshell.CreateShortcut("$home\Desktop\nameOfMyShortcut.lnk")
$lnk.TargetPath = "C:\CPS\CPSAPP.exe"
$lnk.Save()


I reckon you are using Vista? In any case, the $home variable will send it
to the correct folder.

Let us know if this helps. Good night!

--
http://www.leedesmond.com/weblog/



"greatbarrier86" wrote:

> Desmond,
>
> I'm lost...i apologize.
>
> Perhaps you could give me some help
>
> I'd like to put a shortcut on the C:\Users\Public\Desktop location pointing
> to C:\CPS\CPSAPP.exe
>
> Could you perhaps write that for me? At least then, i would understand it
> for future scripts.
>
> "Desmond Lee" wrote:
>
> > Give it a go and let us know if we could be of further help.
> >
> >
> > Thanks greatbarrier86.
> >
> > --
> > http://www.leedesmond.com/weblog/
> >
> >
> >
> > "greatbarrier86" wrote:
> >
> > > Desmond
> > >
> > > Thanks...but it still is slightly confusing to me. I think i can get it
> > >
> > > Thanks!!
> > >
> > > "Desmond Lee" wrote:
> > >
> > > > Yes. Take a look at a previous post if this helps.
> > > >
> > > > http://www.leedesmond.com/weblog/?p=60
> > > >
> > > > Thanks.
> > > > --
> > > > http://www.leedesmond.com/weblog/
> > > >
> > > >
> > > >
> > > > "greatbarrier86" wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > is it possible to use Powershell to create a desktop shortcut icon to one of
> > > > > my company's programs. right now, i'm using a VB script to do it,but it would
> > > > > be better if i could get Powershell to do it.

My System SpecsSystem Spec
Old 08-13-2007   #7 (permalink)
greatbarrier86


 
 

RE: Creating shortcuts with PowerShell

Wow...thank you.
$home equals the Public Desktop folder?

"Desmond Lee" wrote:

> $wshshell = New-Object -ComObject WScript.Shell
> $lnk = $wshshell.CreateShortcut("$home\Desktop\nameOfMyShortcut.lnk")
> $lnk.TargetPath = "C:\CPS\CPSAPP.exe"
> $lnk.Save()
>
>
> I reckon you are using Vista? In any case, the $home variable will send it
> to the correct folder.
>
> Let us know if this helps. Good night!
>
> --
> http://www.leedesmond.com/weblog/
>
>
>
> "greatbarrier86" wrote:
>
> > Desmond,
> >
> > I'm lost...i apologize.
> >
> > Perhaps you could give me some help
> >
> > I'd like to put a shortcut on the C:\Users\Public\Desktop location pointing
> > to C:\CPS\CPSAPP.exe
> >
> > Could you perhaps write that for me? At least then, i would understand it
> > for future scripts.
> >
> > "Desmond Lee" wrote:
> >
> > > Give it a go and let us know if we could be of further help.
> > >
> > >
> > > Thanks greatbarrier86.
> > >
> > > --
> > > http://www.leedesmond.com/weblog/
> > >
> > >
> > >
> > > "greatbarrier86" wrote:
> > >
> > > > Desmond
> > > >
> > > > Thanks...but it still is slightly confusing to me. I think i can get it
> > > >
> > > > Thanks!!
> > > >
> > > > "Desmond Lee" wrote:
> > > >
> > > > > Yes. Take a look at a previous post if this helps.
> > > > >
> > > > > http://www.leedesmond.com/weblog/?p=60
> > > > >
> > > > > Thanks.
> > > > > --
> > > > > http://www.leedesmond.com/weblog/
> > > > >
> > > > >
> > > > >
> > > > > "greatbarrier86" wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > is it possible to use Powershell to create a desktop shortcut icon to one of
> > > > > > my company's programs. right now, i'm using a VB script to do it,but it would
> > > > > > be better if i could get Powershell to do it.

My System SpecsSystem Spec
Old 08-13-2007   #8 (permalink)
Marty List


 
 

Re: Creating shortcuts with PowerShell


Usually the Desktop folder is a subfolder of the user's profile, but not
always. It might be safer to ask the Shell (Explorer) for the current
user's Desktop path:

$ShellApplication = New-Object –com Shell.Application
$DesktopFolderID = 0x10
$DesktopFolderPath =
($ShellApplication.namespace($DesktopFolderID)).Self.Path


"greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
news:4F99C25F-0F7E-411B-8F2F-957E855E5610@microsoft.com...
> Wow...thank you.
> $home equals the Public Desktop folder?
>
> "Desmond Lee" wrote:
>
>> $wshshell = New-Object -ComObject WScript.Shell
>> $lnk = $wshshell.CreateShortcut("$home\Desktop\nameOfMyShortcut.lnk")
>> $lnk.TargetPath = "C:\CPS\CPSAPP.exe"
>> $lnk.Save()
>>
>>
>> I reckon you are using Vista? In any case, the $home variable will send
>> it
>> to the correct folder.
>>
>> Let us know if this helps. Good night!
>>
>> --
>> http://www.leedesmond.com/weblog/
>>
>>
>>
>> "greatbarrier86" wrote:
>>
>> > Desmond,
>> >
>> > I'm lost...i apologize.
>> >
>> > Perhaps you could give me some help
>> >
>> > I'd like to put a shortcut on the C:\Users\Public\Desktop location
>> > pointing
>> > to C:\CPS\CPSAPP.exe
>> >
>> > Could you perhaps write that for me? At least then, i would understand
>> > it
>> > for future scripts.
>> >
>> > "Desmond Lee" wrote:
>> >
>> > > Give it a go and let us know if we could be of further help.
>> > >
>> > >
>> > > Thanks greatbarrier86.
>> > >
>> > > --
>> > > http://www.leedesmond.com/weblog/
>> > >
>> > >
>> > >
>> > > "greatbarrier86" wrote:
>> > >
>> > > > Desmond
>> > > >
>> > > > Thanks...but it still is slightly confusing to me. I think i can
>> > > > get it
>> > > >
>> > > > Thanks!!
>> > > >
>> > > > "Desmond Lee" wrote:
>> > > >
>> > > > > Yes. Take a look at a previous post if this helps.
>> > > > >
>> > > > > http://www.leedesmond.com/weblog/?p=60
>> > > > >
>> > > > > Thanks.
>> > > > > --
>> > > > > http://www.leedesmond.com/weblog/
>> > > > >
>> > > > >
>> > > > >
>> > > > > "greatbarrier86" wrote:
>> > > > >
>> > > > > > Hi,
>> > > > > >
>> > > > > > is it possible to use Powershell to create a desktop shortcut
>> > > > > > icon to one of
>> > > > > > my company's programs. right now, i'm using a VB script to do
>> > > > > > it,but it would
>> > > > > > be better if i could get Powershell to do it.


My System SpecsSystem Spec
Old 08-13-2007   #9 (permalink)
greatbarrier86


 
 

Re: Creating shortcuts with PowerShell

Marty

I dont want the current user. I would actually like the shortcut to apply to
all users.

Could i just do
$lnk =
$wshshell.CreateShortcut("C:\Users\Public\Desktop\nameOfMyShortcut.lnk")


"Marty List" wrote:

>
> Usually the Desktop folder is a subfolder of the user's profile, but not
> always. It might be safer to ask the Shell (Explorer) for the current
> user's Desktop path:
>
> $ShellApplication = New-Object –com Shell.Application
> $DesktopFolderID = 0x10
> $DesktopFolderPath =
> ($ShellApplication.namespace($DesktopFolderID)).Self.Path
>
>
> "greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
> news:4F99C25F-0F7E-411B-8F2F-957E855E5610@microsoft.com...
> > Wow...thank you.
> > $home equals the Public Desktop folder?
> >
> > "Desmond Lee" wrote:
> >
> >> $wshshell = New-Object -ComObject WScript.Shell
> >> $lnk = $wshshell.CreateShortcut("$home\Desktop\nameOfMyShortcut.lnk")
> >> $lnk.TargetPath = "C:\CPS\CPSAPP.exe"
> >> $lnk.Save()
> >>
> >>
> >> I reckon you are using Vista? In any case, the $home variable will send
> >> it
> >> to the correct folder.
> >>
> >> Let us know if this helps. Good night!
> >>
> >> --
> >> http://www.leedesmond.com/weblog/
> >>
> >>
> >>
> >> "greatbarrier86" wrote:
> >>
> >> > Desmond,
> >> >
> >> > I'm lost...i apologize.
> >> >
> >> > Perhaps you could give me some help
> >> >
> >> > I'd like to put a shortcut on the C:\Users\Public\Desktop location
> >> > pointing
> >> > to C:\CPS\CPSAPP.exe
> >> >
> >> > Could you perhaps write that for me? At least then, i would understand
> >> > it
> >> > for future scripts.
> >> >
> >> > "Desmond Lee" wrote:
> >> >
> >> > > Give it a go and let us know if we could be of further help.
> >> > >
> >> > >
> >> > > Thanks greatbarrier86.
> >> > >
> >> > > --
> >> > > http://www.leedesmond.com/weblog/
> >> > >
> >> > >
> >> > >
> >> > > "greatbarrier86" wrote:
> >> > >
> >> > > > Desmond
> >> > > >
> >> > > > Thanks...but it still is slightly confusing to me. I think i can
> >> > > > get it
> >> > > >
> >> > > > Thanks!!
> >> > > >
> >> > > > "Desmond Lee" wrote:
> >> > > >
> >> > > > > Yes. Take a look at a previous post if this helps.
> >> > > > >
> >> > > > > http://www.leedesmond.com/weblog/?p=60
> >> > > > >
> >> > > > > Thanks.
> >> > > > > --
> >> > > > > http://www.leedesmond.com/weblog/
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > "greatbarrier86" wrote:
> >> > > > >
> >> > > > > > Hi,
> >> > > > > >
> >> > > > > > is it possible to use Powershell to create a desktop shortcut
> >> > > > > > icon to one of
> >> > > > > > my company's programs. right now, i'm using a VB script to do
> >> > > > > > it,but it would
> >> > > > > > be better if i could get Powershell to do it.

>

My System SpecsSystem Spec
Old 08-13-2007   #10 (permalink)
greatbarrier86


 
 

Re: Creating shortcuts with PowerShell

Marty

Is it possible to use a variable that refers to the Public directory? i know
$home refers to the current user directory, but what about the public one?

"Marty List" wrote:

>
> Usually the Desktop folder is a subfolder of the user's profile, but not
> always. It might be safer to ask the Shell (Explorer) for the current
> user's Desktop path:
>
> $ShellApplication = New-Object –com Shell.Application
> $DesktopFolderID = 0x10
> $DesktopFolderPath =
> ($ShellApplication.namespace($DesktopFolderID)).Self.Path
>
>
> "greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
> news:4F99C25F-0F7E-411B-8F2F-957E855E5610@microsoft.com...
> > Wow...thank you.
> > $home equals the Public Desktop folder?
> >
> > "Desmond Lee" wrote:
> >
> >> $wshshell = New-Object -ComObject WScript.Shell
> >> $lnk = $wshshell.CreateShortcut("$home\Desktop\nameOfMyShortcut.lnk")
> >> $lnk.TargetPath = "C:\CPS\CPSAPP.exe"
> >> $lnk.Save()
> >>
> >>
> >> I reckon you are using Vista? In any case, the $home variable will send
> >> it
> >> to the correct folder.
> >>
> >> Let us know if this helps. Good night!
> >>
> >> --
> >> http://www.leedesmond.com/weblog/
> >>
> >>
> >>
> >> "greatbarrier86" wrote:
> >>
> >> > Desmond,
> >> >
> >> > I'm lost...i apologize.
> >> >
> >> > Perhaps you could give me some help
> >> >
> >> > I'd like to put a shortcut on the C:\Users\Public\Desktop location
> >> > pointing
> >> > to C:\CPS\CPSAPP.exe
> >> >
> >> > Could you perhaps write that for me? At least then, i would understand
> >> > it
> >> > for future scripts.
> >> >
> >> > "Desmond Lee" wrote:
> >> >
> >> > > Give it a go and let us know if we could be of further help.
> >> > >
> >> > >
> >> > > Thanks greatbarrier86.
> >> > >
> >> > > --
> >> > > http://www.leedesmond.com/weblog/
> >> > >
> >> > >
> >> > >
> >> > > "greatbarrier86" wrote:
> >> > >
> >> > > > Desmond
> >> > > >
> >> > > > Thanks...but it still is slightly confusing to me. I think i can
> >> > > > get it
> >> > > >
> >> > > > Thanks!!
> >> > > >
> >> > > > "Desmond Lee" wrote:
> >> > > >
> >> > > > > Yes. Take a look at a previous post if this helps.
> >> > > > >
> >> > > > > http://www.leedesmond.com/weblog/?p=60
> >> > > > >
> >> > > > > Thanks.
> >> > > > > --
> >> > > > > http://www.leedesmond.com/weblog/
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > "greatbarrier86" wrote:
> >> > > > >
> >> > > > > > Hi,
> >> > > > > >
> >> > > > > > is it possible to use Powershell to create a desktop shortcut
> >> > > > > > icon to one of
> >> > > > > > my company's programs. right now, i'm using a VB script to do
> >> > > > > > it,but it would
> >> > > > > > be better if i could get Powershell to do it.

>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
creating shortcuts PowerShell
Creating and deleting shortcuts VB Script
Need help creating shortcuts VB Script
Vista not creating shortcuts? Vista General
Creating shortcuts from PowerShell 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