someuser77 Posted May 11, 2005 Share Posted May 11, 2005 helloi am writing a small batch file and i need it to create a shortcut on Windows 2000 to a specific file.i know it can be done in vbs, the question is how do i do it in a batch file? Link to comment Share on other sites More sharing options...
oneless Posted May 11, 2005 Share Posted May 11, 2005 I dont know how can you creat a link with a batch file ,but when I need once thatI created the link manually , I save it (is a file)and then I copy the link in the right location on another computer .if the destination file is also in the right place (where point the link) , is ok ! Link to comment Share on other sites More sharing options...
someuser77 Posted May 11, 2005 Author Share Posted May 11, 2005 well, in that case i will have to carry around 2 files: the .bat and the .lnk. no fun.the point is to make one file, that will generate what it needs. Link to comment Share on other sites More sharing options...
MtK Posted May 11, 2005 Share Posted May 11, 2005 helloi am writing a small batch file and i need it to create a shortcut on Windows 2000 to a specific file.i know it can be done in vbs, the question is how do i do it in a batch file?<{POST_SNAPBACK}>you could use this:Shortcut creator Link to comment Share on other sites More sharing options...
someuser77 Posted May 11, 2005 Author Share Posted May 11, 2005 thank you for your reply, but again:i will need to carry around 2 files: the .bat and the .exe. no fun.the point is to make one file, that will generate what it needs.do you think it can be done?i found something over here but the code is too messy for me to read. do you think it can be rewritten to somehting? Link to comment Share on other sites More sharing options...
MtK Posted May 11, 2005 Share Posted May 11, 2005 thank you for your reply, but again:i will need to carry around 2 files: the .bat and the .exe. no fun.the point is to make one file, that will generate what it needs.do you think it can be done?i found something over here but the code is too messy for me to read. do you think it can be rewritten to somehting?<{POST_SNAPBACK}>where exactly is the SHORCUT code over there? Link to comment Share on other sites More sharing options...
gunsmokingman Posted May 12, 2005 Share Posted May 12, 2005 (edited) I dont know if this will help here is a script that makes shortcuts .It Works Like This1\ You input a name2\ You Type In a number for a icon from shell32.dll3\ A Dialog opens up amd you use that to select the app you want a short cut to. 4\ It leaves the shortcut on desktop. Edit To Your Needs Dim shell, X1, X2, X3, Mx2, Mx2a, Z2 Set Shell = WScript.CreateObject("WScript.Shell") Set ObjFSO = CreateObject("UserAccounts.CommonDialog") function recall X2=ObjFSO.FileName Mx2 = "You Selected: " & X2 shell.popup Mx2 , 3, "Gsm ShortCut Maker", 0 + 64 end function function NotThere X3="No File Was Selected" & Vbcrlf & "Preparing To Quit" shell.popup X3, 3, "Exiting Script",0 + 64 end function Function GsmGetFile ObjFSO.Filter = "All Files|*.*" InitFSO = ObjFSO.ShowOpen If InitFSO = False Then NotThere Wscript.Quit Else X2=ObjFSO.FileName recall Set Shell = nothing Set ObjFSO = nothing End If End Function Set sh = CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") Set oWS = WScript.CreateObject("WScript.Shell") struser = InputBox("Type In The Name Of The ShortCut","GsmMakeShortCut","GsmSC") strIcon = InputBox("Type In The Icon You Want From Shell32.dll" &_ vbCrLf & "Recommended Icons Number Are" & vbCrLf & "15" & Space(5) & "19" & Space(5) & "155, ","GsmMakeShortCut","GsmSC") GsmGetFile strApp = X2 set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop & "\" & struser & ".lnk") oShellLink.TargetPath = strApp oShellLink.WindowStyle = 1 oShellLink.Hotkey = "Ctrl+Alt+e" oShellLink.IconLocation = "shell32.dll," & strIcon 'Zero is the index oShellLink.Description = "Shortcut Script" oShellLink.WorkingDirectory = "\.." oShellLink.Save wshShell.Popup "Hello",4, "Gsm",0+48+1024 Edited December 28, 2005 by gunsmokingman Link to comment Share on other sites More sharing options...
Aegis Posted May 12, 2005 Share Posted May 12, 2005 Or an even better method:RUNDLL32.EXE APPWIZ.CPL,NewLinkHere (Dest) Link to comment Share on other sites More sharing options...
gunsmokingman Posted May 12, 2005 Share Posted May 12, 2005 Or an even better method:RUNDLL32.EXE APPWIZ.CPL,NewLinkHere (Dest)<{POST_SNAPBACK}>Tell Me how it betterCan you choice the iconCan you select any thing on your local hard driveDoes it have the a hot key attach to it.oShellLink.Hotkey = "Ctrl+Alt+e"Plus It leave it on the desktop, and with minormodification you could leave it on the start menu.I tried it and could not find any short cuts or get it to workon my desktop. Link to comment Share on other sites More sharing options...
someuser77 Posted May 12, 2005 Author Share Posted May 12, 2005 where exactly is the SHORCUT code over there?its a batch script designed to make a shortcut. or so it says.thanks for the code gunsmokingman, but i will have to add a .vbs file to the batch, i'll do so if theres no other way.Aegis, the line opens a wizard that requires user input. losing the point of the script.what i did manage to do is to find this article about making shortcuts, but i cant get it to work. [Version] signature="$CHICAGO$"[DefaultInstall]UpdateInis=Addlink[AddLink] setup.ini, progman.groups,, "group1=""c:\""" setup.ini, group1,,"""thisIsMyShortcut"",""explorer.exe"",,,,,""explorer.exe""" Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted May 12, 2005 Share Posted May 12, 2005 Make the short cut, zip it in an sfx file and direct the sfx file to unzip silently to wherever the destination is. Link to comment Share on other sites More sharing options...
someuser77 Posted May 12, 2005 Author Share Posted May 12, 2005 again, in that case i will have 2 files: .bat and .exei am trying to make only one .bat file that will do the job.i know i can make one .exe file that will hold all the files i need, but i wouldnt want users to think they have to install something when they dont. Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 12, 2005 Share Posted May 12, 2005 2someuser: You cant make shortcut from batch file - only thing you can do is to create "temporary" script/inf file from batch, call it and delete it after - this is the same technology as Rob used in your link. Link to comment Share on other sites More sharing options...
someuser77 Posted May 12, 2005 Author Share Posted May 12, 2005 okay..vbs and .inf are bouth silent, right?so we know how to make a .vbs, now how do i make a .inf that will create a shortcut? Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 12, 2005 Share Posted May 12, 2005 Simple...[version]signature=$chicago$[DefaultInstall]UpdateInis=AddShortcut[AddShortcut]setup.ini, progman.groups,, "group1=""Calculator Group"""setup.ini, group1,,"""Calculator"",""%windir%\system32\calc.exe"",,,,%17%" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now