Skip to content

Windows 7 SetStart.vbs

Featured Replies

Hey guys, trying to dynamically create a shortcut in the start menu but failing misserably... point is to start this link during our OSD for Windows 7....for all intensive purposes, it should work, but wont display the link in the all users.... ideas?

 

 

' Initialization
Program = "SetStart.vbs"

Set shell = CreateObject("Wscript.Shell")


' Create the shortcut and point it to the specified script (assume C:\Build)

' path = shell.SpecialFolders("ProgramData") & "C:\Profiles\Profiles\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" & "\Startup.lnk"
path = "C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup" & "\Startup.lnk"
Set link = shell.CreateShortcut(path)
link.TargetPath = "C:\Build\" & WScript.Arguments.Item(0)  ' Name of the file to start
If WScript.Arguments.Count > 1 then
   plog "Link = " & WScript.Arguments.Item(1)
   link.Arguments = WScript.Arguments.Item(1)  ' Parameters to pass
End if
link.Save

 

  • 1 month later...

Not sure about your coding but could this be a folder rights issue? The users folder point to ProgramData and if you try to get into the Start Menu you will get Access Denied.

  • 3 months later...

nah, permissions are ok, puts the file there, just doesnt seem to work...weird

 

 

try this:

 

Dim WSHShell

Set WSHShell = WScript.CreateObject("WScript.Shell")

 

 

Dim MyShortcut, MyDesktop, DesktopPath

 

DesktopPath = WSHShell.SpecialFolders("Desktop")

 

Set MyShortcut = WSHShell.CreateShortcut(DesktopPath & "\Shortcut to notepad.lnk")

 

MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings("%windir%\notepad.exe")

MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings("%windir%")

MyShortcut.WindowStyle = 4

MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings("%windir%\notepad.exe, 0")

MyShortcut.Save

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.