Jump to content

how can i create a shortcut from a batch file?


Recommended Posts


http://www.abyssmedia.com/

This compay do a program called Qick Batch File Compiler. It converts your batch file to a an EXE and lets you inclued customs resources such as other files. Although not a batch file in the end you will only have onne file to carry around.

Maybe not what you are looking for but someting to think about

hail hail

Link to comment
Share on other sites

You need to search this site, two different methods using inf files have been posted regarding this subject. One of the subjects has been discussed in the last few days. Try a search for +inf +shortcut

Link to comment
Share on other sites

If You want to run a vbs from batch plus clean up the files

This makes it only 1 file

Green is what you add to the script

Blue is the script varible

Echo off && Cls && Mode 55,5 && Color 5e && Title Shortcut

set VBS=%systemdrive%\MyVbsShortcut.vbs

>> %vbs% echo  Dim WshShell : set WshShell = WScript.CreateObject("WScript.Shell")

>> %vbs%echo  Dim Fso : set Fso = WScript.CreateObject("Scripting.FileSystemObject")

>> %vbs%echo  strDesktop = WshShell.SpecialFolders("Desktop")

>> %vbs%echo  set oShellLink = WshShell.CreateShortcut(strDesktop ^& "\  PLACE_NAME_HERE .lnk")

>> %vbs% echo   oShellLink.TargetPath = THE_LOCATION_OF_THE_SHORTCUT_TO_APP 'EG: NOTEPAD.EXE

>> %vbs%echo  oShellLink.WindowStyle = 1

>> %vbs%echo  oShellLink.Hotkey = "Ctrl+Alt+e"

>> %vbs%echo  oShellLink.IconLocation = "shell32.dll, ^& PLACE_NUNBER_OF_ICON_HERE " 'Zero is the index        

>> %vbs% echo   oShellLink.Description = "My shortcut to NAME_WHATEVER"

>> %vbs%echo  oShellLink.WorkingDirectory = "\.."

>> %vbs%echo   oShellLink.Save

>> %vbs%echo           wshShell.Popup "Hello",4, "Gsm",0+48+1024 'This Line Is safe to remove

>> %vbs%echo  Fso.deleteFile("NAME_OF_BATCH_HERE")

>> %vbs%echo  Fso.deleteFile(" %vbs% ")

start %vbs%

Edited by gunsmokingman
Link to comment
Share on other sites

thank you for your help, but i need to get access to the windir, unfortenately this is not working:

Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.Environment("Volatile").Item("windir")

it returns a blank line.

Link to comment
Share on other sites

hi,

I am new in this forum, so please guide my way...

I have foxit pdf reader that no need to be installed, just copy it into root directory or somewhere else...

my problem is, how do I make an automatic foxit shortcut into desktop ?

thanks...

Link to comment
Share on other sites

@ Raynold

You would need to add something like this to your inf, do a search as suggested previously for the relevant thread, in order to find out the rest of the information etc.

setup.ini, progman.groups,, "group0=""%16409%\"""
setup.ini, group0,,"""Foxit PDF"",""""""%16422%\FolderName\ExeName"""""",,,,""%16389%"""

where

  • %16409% is %ALLUSERSPROFILE%\Desktop, (the shortcut location)
    %16422% is %ProgramFiles%, (the usual location of your program folder)
    %16389% is %USERPROFILE%\My Documents, (the start in directory)
    FolderName is The name of the folder in containing your program executable
    ExeName is The name of program executable, (i.e. something.exe)

Link to comment
Share on other sites

  • 2 weeks later...

I don't know whether this is the correct thread for this post but I do have question regarding INF & SHORTCUTS. So here it goes:

The INF below is use to install a program call ConvertZ. It copy all the files & create shortcuts without problem. But when uninstall, the shortcuts & install folder remain. So can you guys tell me what to add to my INF so the shortcuts & folder created can be remove when uninstall?

[Version]
Signature="$CHICAGO$"

[DefaultInstall]
RequiredEngine = Setupapi
CopyFiles      = ConvertZ.copy
UpdateInis     = AddLink
AddReg         = Startup.Reg, Uninst.Reg

[DefaultUninstall]
RequiredEngine = Setupapi
DelFiles       = ConvertZ.del
DelReg         = Startup.Reg

[DestinationDirs]
DefaultDestDir=11
ConvertZ.copy=16422,%ConvertZ%
ConvertZ.del=16422,%ConvertZ%

[ConvertZ.copy]
B5fix.dat
ConvertZ.cnt
ConvertZ.exe
ConvertZ.hlp
gbfix.dat
convertz.inf

[ConvertZ.del]
B5fix.dat
ConvertZ.cnt
ConvertZ.exe
ConvertZ.hlp
gbfix.dat
convertz.inf

[AddLink]
setup.ini, progman.groups,, ""group1="%16395%\"""
setup.ini, group1,,"""ConvertZ v740"",""""""%16422%\ConvertZv740\ConvertZ.exe"""""""

setup.ini, progman.groups,, ""group2="%16410%\Microsoft\Internet Explorer\Quick Launch\"""
setup.ini, group2,,"""ConvertZ v740"",""""""%16422%\ConvertZv740\ConvertZ.exe"""""""

[Startup.Reg]
HKCU, "SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "ConvertZ v740",,""%16422%\ConvertZv740\ConvertZ.exe""

[Uninst.Reg]
HKLM,"Software\Microsoft\Windows\CurrentVersion\Uninstall\ConvertZ v740","DisplayName",,"ConvertZ v740"
HKLM,"Software\Microsoft\Windows\CurrentVersion\Uninstall\ConvertZ v740","UninstallString",,"rundll32.exe setupapi.dll,InstallHinfSection DefaultUninstall 132 "%16422%\ConvertZv740\ConvertZ.inf""
HKLM,"Software\Microsoft\Windows\CurrentVersion\Uninstall\ConvertZ v740", "DisplayIcon",,%16422%\ConvertZv740\ConvertZ.exe

[Strings]
ConvertZ = "ConvertZv740"

Link to comment
Share on other sites

Its simple very:

The example with FoxIt Reader

Use your winrar and follow next:

1. Right Click in your foxitreader file and choose: Add to file...

2. Check: Create a solid file & Create a ile SFX

3. Choose tab Advanced and click SFX Options

In General Tab:

- Create in program files (Add a filename)

In Advanced tab:

- Create shortcut (my shrotcut is: P, "FoxitReader13", "FoxIt Reader", "FoxIt Reader 1.3b", "FoxIt Reader 1.3b") where: Blue is shortcut type (P is in Start Menu\Programs); Purple is Origen File (My file its call FoxitReader13.exe); Red is the folder name; Black is file description; And Green is the name to shortcut

4. In Modes tab, Choose All hidden & Overwrite files.

5. In Icon And Text tab, choose your iconfile.ico

Thats all!! :thumbup

The shortcut is created in Start Button, All programs, FoxIt Reader, FoxIt Reader 1.3b.lnk

I hope has been useful and understandable.

Sorry for my bad english. :unsure:

Greetings :hello:

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...