Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Create Shortcut With A Batch File
Closed Thread
Old 09-17-2004, 07:33 PM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2004

Posts: 2

skrape

Default Create Shortcut With A Batch File

I am trying to make a batch file that creates a shortcut to a folder. I am using Windows XP.

Am I missing something or is there no clear cut way to accomplish this?
skrape is offline  
Old 09-18-2004, 03:20 AM   #2 (permalink)
 
Super Techie

Join Date: Jun 2004

Posts: 312

sippin codeine

Send a message via Yahoo to sippin codeine
Default

I don't think you can do this with a bat file, you *might* be able to do it with a vbs file, I really hate vb and I get a headache when looking at that code so you should check out google to see if you can find some examples.

EDIT:
I found this sad piece of text, but its for VB, and not a VBS file, so you would have to do some modifiction if it will even work.

Code:
Dim WSHShell, fs

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

Set fs = WScript.CreateObject("Scripting.FileSystemObject")

Function MakeDesktopShortcut( name, target )

Dim Shortcut,DesktopPath,StartupPath

DesktopPath = WSHShell.SpecialFolders("Desktop")

Set Shortcut = WSHShell.CreateShortcut(DesktopPath & "\" &

name & ".lnk")

Shortcut.TargetPath = target

StartupPath = fs.GetParentFolderName( target )

If fs.FolderExists( StartupPath ) then

   Shortcut.WorkingDirectory = StartupPath

End If

Shortcut.Save

End Function

MakeDesktopShortcut "Shortcut to Notepad", "C:\Windows\-Notepad.exe"

__________________
**[System specs]**

Delphi Enterprise 6 - 7
VB 6.0 - 2005 EE
sippin codeine is offline  
Old 09-18-2004, 10:11 AM   #3 (permalink)
 
Newb Techie

Join Date: Sep 2004

Posts: 2

skrape

Default

My only problem with using VB to accomplish this is the fact that I would have to run the project through the Package and Deployment Wizard.
After all of the dependencies are included (for people who do not have VB runtime installed), the file would be rather large. This has been my main problem with VB all along.
I am trying to make this batch file available on my website and a complete VB app would suck up too much of my bandwidth. I think if I would do this in anything else, it would be C++.
The problem with that is that most people are not going to want to d/l and run an exe. At least with batch files, you can see exactly whats going on.

Thanks for the input =)
skrape is offline  
Old 10-01-2004, 05:11 PM   #4 (permalink)
 
True Techie

Join Date: Jul 2004

Posts: 217

NeoNemesis

Send a message via AIM to NeoNemesis
Default

YOu could always just put a link to it on in the folder for your desktop found in My Documents if you go through C:\Documents and Settings\Your user name\Desktop
__________________
<font size=\"4\" <a href=\"http://s7.invisionfree.com/NeoForum/index.php\">My Forum</a>
we are just starting out so we need you to join!
NeoNemesis is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On