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 - .vbs Script To Create Start / Programs Menu Item??

Reply
 
Old 07-31-2009   #1 (permalink)
Andy


 
 

.vbs Script To Create Start / Programs Menu Item??

Hi Gang

Sorry but I'm new to this. I need to create a script (.vbs) that
will
check if the current user has a particular menu item in his/her Start
menu / Programs. If not then it creates it and applies the right
properties to it.


Can someone help me create this script?


Thanks
Andy

My System SpecsSystem Spec
Old 07-31-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: .vbs Script To Create Start / Programs Menu Item??


"Andy" <andy.mcvicker@xxxxxx> wrote in message
news:2b4de72e-a394-471d-8e91-e70687e62e93@xxxxxx
Quote:

> Hi Gang
>
> Sorry but I'm new to this. I need to create a script (.vbs) that
> will
> check if the current user has a particular menu item in his/her Start
> menu / Programs. If not then it creates it and applies the right
> properties to it.
>
>
> Can someone help me create this script?
>
>
> Thanks
> Andy
The easiest way is to run this two-line batch file:
@echo off
if not exist "%UserProfile%\Start Menu\Programs\xxx.lnk"
c:\tools\shortcut.exe /x /y /z

Note that the second line starts with "if" and ends with "/z". You can
download shortcut.exe from here: http://www.optimumx.com/download/#Shortcut.


My System SpecsSystem Spec
Old 08-01-2009   #3 (permalink)
mayayana


 
 

Re: .vbs Script To Create Start / Programs Menu Item??

'----------------------------------------
Dim FSO, SH, oFol, oFils, oLNK

Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists("C:\windows\start menu\programs\Notepad.lnk") = True
Then DropIt
Set SH = CreateObject("WScript.Shell")
Set oLNK = SH.CreateShortcut("C:\windows\start menu\programs\Notepad.lnk")
With oLNK
.TargetPath = "C:\Windows\Notepad.exe"
.IconLocation = "C:\Windows\Notepad.exe"
.Save
End With
Set oLNK = Nothing
DropIt

Sub DropIt()
Set FSO = Nothing
Set SH = Nothing
WScript.Quit
End Sub
'---------------------------

This sample was written on Win98. On NT systems
you'll need to have admin rights and find the intended
user's settings folder down inside the C:\Documents
and Settings mess, or whatever it's called now on
Vista/7. But once you have the right folder path, the
rest is pretty much the same.

The trick is in knowing about the properties and
methods of the objects used:
Scripting.FileSystemObject
WScript.Shell
Shortcut

The first two objects are used extensively in VBScript.
If you don't download the help file and study those
then you won't be able to make much sense out of scripts
and you won't be able to write them yourself.

http://www.microsoft.com/downloads/d...C48-207D-4BE1-
8A76-1C4099D7BBB9&displaylang=en
Quote:

>
> Sorry but I'm new to this. I need to create a script (.vbs) that
> will
> check if the current user has a particular menu item in his/her Start
> menu / Programs. If not then it creates it and applies the right
> properties to it.
>
>
> Can someone help me create this script?
>
>
> Thanks
> Andy

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Unusual Start Menu Item... Vista General
How do I add an item to the start menu above Programs? Vista General
Weird problem: new programs don't create a folder in the Start menu... Vista General
Start Menu Item Vista General
Videos item for Start Menu? Vista General


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