Computer Hope

Microsoft => Microsoft DOS => Topic started by: The_Game_Bane on December 11, 2009, 06:13:03 AM

Title: Want To Create Shortcut with batch
Post by: The_Game_Bane on December 11, 2009, 06:13:03 AM
hey guys...

Pls sum1 help me abt

How 2 create shortcut on desktop Using Batch file

i cud also prefer command line software with quiet mode

or

Directly with dos


i tried the command line

xcopy r11.exe %AllUsersProfile%\desktop\r11.lnk

wher am i going wrong
Title: Re: Want To Create Shortcut with batch
Post by: ghostdog74 on December 11, 2009, 06:58:53 AM
you can create shortcut with vbscript
Code: [Select]
Set oWS = WScript.CreateObject("WScript.Shell") 
shortCut = "C:\temp\myshortcut.lnk"   
Set oLink = oWS.CreateShortcut(shortCut)   
oLink.TargetPath = "C:\temp\test.bat"
oLink.WorkingDirectory = "C:\temp"
oLink.Save

Title: Re: Want To Create Shortcut with batch
Post by: billrich on December 11, 2009, 09:00:40 AM
hey guys...


How 2 create shortcuts on desktop Using Batch file


I tried the command line

xcopy r11.exe %AllUsersProfile%\desktop\

where am I going wrong.

You are right.  The command line is the testing  ground for batch.

Did  the xcopy  command work at the command line?:
 
xcopy r11.exe %AllUsersProfile%\desktop\

Place in batch file , mycopy.bat

C:\batch>type  mycopy.bat

xcopy r11.exe %AllUsersProfile%\desktop\

C:\batch> mycopy.bat
Title: Re: Want To Create Shortcut with batch
Post by: The_Game_Bane on December 11, 2009, 09:16:26 AM
You are right.  The command line is the testing  ground for batch.

Did  the xcopy  command work at the command line?:
 
xcopy r11.exe %AllUsersProfile%\desktop\

Place in batch file , mycopy.bat

C:\batch>type  mycopy.bat

xcopy r11.exe %AllUsersProfile%\desktop\

C:\batch> mycopy.bat


No it didnt work it just creates a blank shortcut on desktop without any effect or icon
Title: Re: Want To Create Shortcut with batch
Post by: billrich on December 11, 2009, 09:45:10 AM
If the xcopy  command does  not work from the command line,  the
 xcopy command  will not work inside a batch file.

The shortcut is an icon for the batch file.
___________

http://www.tnd.com/camosun/elex130/dosbatchtutor1.html


Making Batch Files


--------------------------------------------------------------------------------

"A batch file is a normal text file, no programming involved. You type DOS commands into a text file, each one on a seperate line. Then, you give the text file a .bat extension instead of a .txt extension. Now, when you double click the batch file(In Windows Explorer) or type its name at the DOS prompt, it will execute the commands.

First, we need to know some DOS commands. If you're a regular DOS user, you can skip this section and go to CREATING A BATCH PROGRAM. The main DOS commands we will use are copy, move, del, cls, and echo. The COPY command has this syntax: "

copy [source] [destination]

.
.
.
Title: Re: Want To Create Shortcut with batch
Post by: BC_Programmer on December 11, 2009, 09:55:11 AM
a shortcut is a LNK file, and is a completely separate file from it's target. Xcopy, copy, or any such command at the command  line will copy the file, not create a shortcut to it.
Title: Re: Want To Create Shortcut with batch
Post by: Helpmeh on December 11, 2009, 04:59:10 PM
If the xcopy  command does  not work from the command line,  the
 xcopy command  will not work inside a batch file.
There was no issue with that, only an issue with the end-result.
Title: Re: Want To Create Shortcut with batch
Post by: billrich on December 11, 2009, 05:40:37 PM
There was no issue with that, only an issue with the end-result.

I believe BC gave the perfect explanation of why The_Game_Bane 's method of creating a shortcut did not work.

The_Game_Bane was given detailed instructions of how to create shortcut for the batch file.

The following command did not work for The_Game_Bane  from the command line or from a Batch file:

xcopy r11.exe %AllUsersProfile%\desktop\r11.lnk

What did work?

I don't know.  No feedback.
Title: Re: Want To Create Shortcut with batch
Post by: ghostdog74 on December 11, 2009, 05:53:25 PM
xcopy r11.exe %AllUsersProfile%\desktop\r11.lnk

this command copies r11.exe to the desktop and name it as r11.lnk, which is NOT a shortcut . Its the ORIGINAL file with a new name. That's how it "can't work" if what OP wants is a shortcut, with a LNK extension.
Title: Re: Want To Create Shortcut with batch
Post by: billrich on December 11, 2009, 06:30:59 PM
(http://i7.photobucket.com/albums/y268/billrich/r11txt.jpg)
Title: Re: Want To Create Shortcut with batch
Post by: billrich on December 11, 2009, 06:49:46 PM


http://www.msfn.org/board/creating-shortcuts-installation-time-t29964.html&hl=creat+shortcut

Title: Re: Want To Create Shortcut with batch
Post by: Sidewinder on December 11, 2009, 07:25:37 PM

http://www.msfn.org/board/creating-shortcuts-installation-time-t29964.html&hl=creat+shortcut



From the linked page:
Code: [Select]
[Version]
Signature=$CHICAGO$

$CHICAGO$ refers to Win95. The OP has WinXP.

If it absolutely has to be batch, there is a batch program in the Windows NT Resource Kit (http://www.microsoft.com/downloads/details.aspx?FamilyID=3E972E9A-E08A-49A2-9D3A-C0519479E85A&displaylang=en) which you can use. Look for Shortcut.exe.

Use shortcut /? from the command line for an explanaton of the switches needed.

Good luck.  8)
Title: Re: Want To Create Shortcut with batch
Post by: The_Game_Bane on December 11, 2009, 10:15:49 PM
there is a software name as XXMKLINK

which gurantees to make shortcuts but i dont understand its switches


i cud also use that if i cud understood
Title: Re: Want To Create Shortcut with batch
Post by: ghostdog74 on December 11, 2009, 11:18:46 PM
have you even tried the various solutions mentioned here?
Title: Re: Want To Create Shortcut with batch
Post by: The_Game_Bane on December 12, 2009, 01:41:47 AM
have you even tried the various solutions mentioned here?

yes ive tried

but smthing or the other goes wrong with me
[I think ther solutions r correct, but im not able to apply them]
Title: Re: Want To Create Shortcut with batch
Post by: The_Game_Bane on December 12, 2009, 01:54:25 AM
REG ADD %KEY%\045 /VE /D "Adding user defined shortcuts" /f
REG ADD %KEY%\045 /V 1 /D "rundll32 setupapi,InstallHinfSection Shortcuts 128 %systemdrive%\Apps\Standalone\shortcuts.inf" /f

Now create a shortcuts.inf file similar to this:
CODE
[Version]
Signature=$CHICAGO$

[Shortcuts]
UpdateInis=AddLink

[AddLink]
;adds shortcut to ERUNT.exe within %ProgramFiles%\Standalone\ERUNT folder to %USERPROFILE%\Start Menu\Programs\Standalone\ERUNT
setup.ini, progman.groups,, "group1=""%16386%\Standalone\ERUNT\"""
setup.ini, group1,,"""ERUNT"",""""""%16422%\Standalone\ERUNT\ERUNT.EXE"""""""



I think this is the Right one

cud this be simplified or xplained


thnks Brillich 4 the post
Title: Re: Want To Create Shortcut with batch
Post by: The_Game_Bane on December 12, 2009, 01:58:34 AM
[AddLink]
;adds shortcut to ERUNT.exe within %ProgramFiles%\Standalone\ERUNT folder to %USERPROFILE%\Start Menu\Programs\Standalone\ERUNT
setup.ini, progman.groups,, "group1=""%16386%\Standalone\ERUNT\"""
setup.ini, group1,,"""ERUNT"",""""""%16422%\Standalone\ERUNT\ERUNT.EXE"""""""


The other part iv understood

wat abt dis part
Title: Re: Want To Create Shortcut with batch
Post by: ghostdog74 on December 12, 2009, 02:19:17 AM
why are you doing something so complicated as to modify the registry.? as directed by sidewinder, you can use shortcut.exe, or just tweak the vbscript i gave. If you have tried them and it doesn't work, show how you did it, and any error messages you encountered.
Title: Re: Want To Create Shortcut with batch
Post by: SAGAR GROVER on July 08, 2013, 12:43:31 AM
hey guys...

Pls sum1 help me abt

How 2 create shortcut on desktop Using Batch file

i cud also prefer command line software with quiet mode

or

Directly with dos


i tried the command line

xcopy r11.exe %AllUsersProfile%\desktop\r11.lnk

wher am i going wrong


use quotes (") in your connand it works just shortcut icon not luk as original file for example i use

xcopy "C:\IGI2\IGI2\igi2.exe" "%AllUsersProfile%\desktop"
Title: Re: Want To Create Shortcut with batch
Post by: SAGAR GROVER on July 08, 2013, 12:49:28 AM
use quotes and it will work defiantly
as your command is
xcopy r11.exe %AllUsersProfile%\desktop\r11.lnk
write like this
xcopy "r11.exe" "%AllUsersProfile%\desktop\r11.lnk"

answer me it works for you or not

Title: Re: Want To Create Shortcut with batch
Post by: patio on July 08, 2013, 05:38:31 AM
He's been gone for over 4 years now.... ::)
Title: Re: Want To Create Shortcut with batch
Post by: foxidrive on July 08, 2013, 06:12:07 AM
He's been gone for over 4 years now.... ::)

...almost.  :D