How to copy shortcuts in a batch file

D

Diane Walker

Is there a way to setup a batch file to copy a shortcut to a user's desktop?
For example, I want to setup a batch file so that it will create an Excel
shortcut (Excel.exe) to a user's desktop.

Thanks.
 
P

Pegasus \(MVP\)

Diane Walker said:
Is there a way to setup a batch file to copy a shortcut to a user's
desktop?
For example, I want to setup a batch file so that it will create an Excel
shortcut (Excel.exe) to a user's desktop.

Thanks.

Do you want to copy and existing shortcut to the user's
desktop or to you want to create a brand new shortcut?
 
D

Diane Walker

I want to create a brand new shortcut and put it on the user's desktop.
Thanks.
 
P

Pegasus \(MVP\)

Here is a VB Script example that will create a shortcut on
the user's desktop:
Set ObjShell = CreateObject("WScript.Shell")
strPath=ObjShell.SpecialFolders("Desktop")
Set objShortcut =ObjShell.CreateShortcut(strPath & "\Internet Explorer
Test.lnk")
objShortcut.TargetPath = "C:\Program Files\Internet Explorer\iexplore.exe"
objShortcut.arguments = "www.google.com"
objShortcut.Description = "Explorer Test"
objShortcut.Save
 
D

Diane Walker

Thank you very much for taking time to this for me. I have to ask you a
dumb question. Do I copy the script to the notepad and save the file as
executable such as install.bat? I am not sure how to execute the script.

Thanks.

Diane
 
P

Pegasus \(MVP\)

You save it to c:\CreateShortcut.vbs (for example) and invoke
it with this command:

cscript //nologo c:\CreateShortcut.vbs
 
D

Diane Walker

Thanks very much.

Pegasus (MVP) said:
You save it to c:\CreateShortcut.vbs (for example) and invoke
it with this command:

cscript //nologo c:\CreateShortcut.vbs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top