sendtojp
asked on
Create shortcut to the desktop and Start --> Programs win 98'-XP in a batch file
I am creating a package of a program and runing the Installation in a Batch file.
The shortcut is pointing to a file in "Program files" (i.e. %appdata%)
Thank You
-JP
The shortcut is pointing to a file in "Program files" (i.e. %appdata%)
Thank You
-JP
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Even be a VB programmer I am unfamilar with a *.vbs file, how is this ran?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here is the contents of the vbs, I meant to write 'Even being a VB Programmer I '
never used a vbs before'. I uess you live and you learn something.
There is a problem with the code I placed MSGBOX's between the code line with the error. The code reachs 'point1' but not 'point2'
'........................
DesktopShortcut "Shortcut to Program", "%programfiles%\Appdir\Tes t.vbs"
'Save following file as DesktopShortcut.vbs
Dim WSHShell, fsObj
Set WSHShell = WScript.CreateObject("WScr ipt.Shell" )
Set fsObj = WScript.CreateObject("Scri pting.File SystemObje ct")
Function DesktopShortcut( name, target )
Dim Shortcut,DesktopPath,Start upPath
msgbox "point1"
DesktopPath = WSHShell.SpecialFolders("D esktop")
msgbox "point2"
Set Shortcut = WSHShell.CreateShortcut(De sktopPath & "\" & name & ".lnk")
Shortcut.TargetPath = target
StartupPath = fsObj.GetParentFolderName( target )
If fsObj.FolderExists( StartupPath ) then
Shortcut.WorkingDirectory = StartupPath
End If
Shortcut.Save
End Function
never used a vbs before'. I uess you live and you learn something.
There is a problem with the code I placed MSGBOX's between the code line with the error. The code reachs 'point1' but not 'point2'
'........................
DesktopShortcut "Shortcut to Program", "%programfiles%\Appdir\Tes
'Save following file as DesktopShortcut.vbs
Dim WSHShell, fsObj
Set WSHShell = WScript.CreateObject("WScr
Set fsObj = WScript.CreateObject("Scri
Function DesktopShortcut( name, target )
Dim Shortcut,DesktopPath,Start
msgbox "point1"
DesktopPath = WSHShell.SpecialFolders("D
msgbox "point2"
Set Shortcut = WSHShell.CreateShortcut(De
Shortcut.TargetPath = target
StartupPath = fsObj.GetParentFolderName(
If fsObj.FolderExists( StartupPath ) then
Shortcut.WorkingDirectory = StartupPath
End If
Shortcut.Save
End Function
ASKER
posting 2:41 was posted before 2:33
ASKER
tymes,
If you are interested I have code to open an Access 2003 database without the Access warning poping up. Off topic but it is good code to have.
If you are interested I have code to open an Access 2003 database without the Access warning poping up. Off topic but it is good code to have.
ASKER
name = Wscript.arguments(0)
target = Wscript.arguments(1)
I get a subscrit out of range error
target = Wscript.arguments(1)
I get a subscrit out of range error
ASKER
Also how do you declear a string in a vbs file
'........................
Dim WSHShell, fsObj
Dim Desktop, Programs As String
Desktop = "%AllusersProfile%\Desktop \"
Programs = "%AllusersProfile%\Program s\Start Menu\"
DesktopShortcut "Shortcut to Program", "%programfiles%\Appdir\Tes t.vbs"
'Save following file as DesktopShortcut.vbs
Set WSHShell = Wscript.CreateObject("WScr ipt.Shell" )
Set fsObj = Wscript.CreateObject("Scri pting.File SystemObje ct")
name = Wscript.arguments(0)
target = Wscript.arguments(1)
'Function DesktopShortcut(name, target)
Dim Shortcut, DesktopPath, StartupPath
MsgBox "point1"
DesktopPath = WSHShell.SpecialFolders("D esktop")
MsgBox "point2"
Set Shortcut = WSHShell.CreateShortcut(De sktopPath & "\" & name & ".lnk")
Shortcut.TargetPath = target
StartupPath = fsObj.GetParentFolderName( target)
If fsObj.FolderExists(Startup Path) Then
Shortcut.WorkingDirectory = StartupPath
End If
Shortcut.Save
'End Function
'........................
Dim WSHShell, fsObj
Dim Desktop, Programs As String
Desktop = "%AllusersProfile%\Desktop
Programs = "%AllusersProfile%\Program
DesktopShortcut "Shortcut to Program", "%programfiles%\Appdir\Tes
'Save following file as DesktopShortcut.vbs
Set WSHShell = Wscript.CreateObject("WScr
Set fsObj = Wscript.CreateObject("Scri
name = Wscript.arguments(0)
target = Wscript.arguments(1)
'Function DesktopShortcut(name, target)
Dim Shortcut, DesktopPath, StartupPath
MsgBox "point1"
DesktopPath = WSHShell.SpecialFolders("D
MsgBox "point2"
Set Shortcut = WSHShell.CreateShortcut(De
Shortcut.TargetPath = target
StartupPath = fsObj.GetParentFolderName(
If fsObj.FolderExists(Startup
Shortcut.WorkingDirectory = StartupPath
End If
Shortcut.Save
'End Function
ASKER
Intellisense doesn't seem to work on WSHShell?
Set WSHShell = Wscript.CreateObject("WScr ipt.Shell" ) ' For reference
Is there a object model description for this?
Is there a .SpecialFolders("Program files")
Does this work on '98 thru XP
I got it to generate a shortcut with modifyation.
Set WSHShell = Wscript.CreateObject("WScr
Is there a object model description for this?
Is there a .SpecialFolders("Program files")
Does this work on '98 thru XP
I got it to generate a shortcut with modifyation.
If you're doing this to install something, you should just use nullsoft's installer and forget about making your own install script. You won't need to care about windows versions or about wshshell stuff or directories etc.
http://nsis.sourceforge.net/
http://nsis.sourceforge.net/
ASKER
The two shortcut cuts I want to make are to the desktop & Programs
barrymercer,
Thanks for writing the shell command
Thanks
-JP