Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

We have the batch program, folders will be created while execute the batch program, exe and INI files are copied into the folder. I have link file for one of the exe. While execute the batch program the linked exe file need to create desktop shortcut automatically. Then application will run. But shortcut will not create and application will not execute. This is my Problem. Please anyone provide solution.

What I have tried:

i try many ways but cannot worked.
echo copy "ABC.lnk" "C:\Users\Public\Desktop"
copy "ABC.lnk" "C:\Users\Public\Desktop"

echo copy "C:\ABC.exe" "%USERPROFILE%\Desktop"
copy "C:ABC.exe" "%USERPROFILE%\Desktop"

Nothing will work
Posted
Updated 21-Feb-21 20:50pm
Comments
Member 10556393 22-Feb-21 3:12am    
Is there anyother method? I am not clear above the solutions.

Please, read this: Creating a shortcut for a exe using a batch file - Stack Overflow[^]

Quote:

Creating a shortcut in the .lnk format is basically impossible from a batch file without calling an external program of some kind.


I'd suggest to use installer or aka-installer for such of functionality, for example:
VisualStudio - ClickOnce[^],
InnoSetup[^],
WinRar[^],
etc.
 
Share this answer
 
v3
Comments
Member 10556393 22-Feb-21 3:13am    
Is there anyother method? I am not clear about the solutions.
Maciej Los 22-Feb-21 3:25am    
Did you read my answer? Seems, you don't. There's a second part of my answer with recommendations.
Member 10556393 22-Feb-21 3:49am    
Hi Maciej Los,
I read your solutions. But my requirements is I will create a batch file and Application exe folder and give to SCCM team to deploy the application in client system. In that batch program I will do everything that means Bin folder created, INI folder created and all the exe files are copied into the Bin folder. Everything runs successfully. But the main exe file shortcut will not create on desktop. The user just double click the exe and needs to run the application. For that how to create exe shortcut from the batch program. I searched in net, some one says use mklink, xcopy or create vbs file. I tried all those. But not work.
Maciej Los 22-Feb-21 7:12am    
As i mentioned. It's impossible to use batch file for such of requirements. You have to use installer.
Using an installer like Inno Setup as Maciej suggested is a good idea, but maybe you find it easier to use VB with the Windows Script Host, see:
winforms - how to create shortcut on desktop in vb.net without installer - Stack Overflow[^]
 
Share this answer
 
Comments
Member 10556393 22-Feb-21 3:13am    
Is there anyother method? I am not clear about the solutions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900