Creating shortcut via script

J

John

Hi

Is there a way to use a batch file or script to do the following;

1. Create a folder X

2. Copy a file form another location to folder X.

3. Create a shortcut to copied file in folder X on the desktop?

If batch or script can not do this, is there another way?

Thanks

Regards
 
J

John

Hi

A couple of additions to the last questions.

How can I

a. Add a specific icon (world icon) form the
%SystemRoot%\system32\SHELL32.dll to the created shortcut?

b. Any way to scan all icons on the desktop and if any shortcut already has
the world icon to change it to something else form
%SystemRoot%\system32\SHELL32.dll ?

Many thanks. Sorry for all the questiosn but I am new to this.

Regards
 
T

Tim Slattery

John said:
Hi

Is there a way to use a batch file or script to do the following;

1. Create a folder X

2. Copy a file form another location to folder X.

These two are easy of course. mkdir to create a folder, copy to copy a
file into it.
3. Create a shortcut to copied file in folder X on the desktop?

That's hard. A Google search turns up this:
http://www.xxcopy.com/xxcopy38.htm. That page describes XXMKLINK which
they claim will create a shortcut from the command line. There's a
link at the bottom of the page to download the tool, which is free.
All I know about it is what's on that page, I've never used it.
 
J

ju.c

Try this:

Shortcut 1.11 24 KB (Freeware)
http://www.optimumx.com/download/#Shortcut

"/
Allows you to create, modify or query Windows shell
links (shortcuts) from the command-line. You can
export the properties of an existing shortcut to a
text file in .INI format. Use 'Shortcut /?' to view
the syntax.
/"


ju.c
 
T

Tim Slattery

ju.c said:
Xxcopy doesn't work with SP3.

Interesting, but I'm not talking about xxcopy. This is a different
program, apparently from the same place, called xxmklink. It doesn't
copy files, it makes a link. I don't see any mention of SP3 on the
page.
 
J

ju.c

How to to do the following with a batch file:

1. Create a folder.
2. Copy a file to the created folder.
3. Create a shortcut on the desktop pointing to the
file that was copied to the created folder.


1. Download required files:

To create the shortcut:
Shortcut 1.11 24 KB (Freeware)
Info: http://www.optimumx.com/download/#Shortcut
Download: http://www.optimumx.com/download/Shortcut.zip

To launch the batch file without a command window:
Hidden Start 2.1 23 KB (Freeware)
Info: http://www.ntwind.com/software/utilities/hstart.html
Download: http://www.ntwind.com/download/hstart.zip

2. Copy both files to C:\WINDOWS\

3. Copy below and paste into Notepad:

----------copy inside only----------
@ECHO OFF

:: Create a folder:
MD "C:\Path To\New folder\"

:: Copy a file to the created folder:
XCOPY "C:\Path To\file.ext" "C:\Path To\New folder\"

:: Create a shortcut on the desktop:
C:\WINDOWS\Shortcut.exe /F:"%UserProfile%\Desktop\file.lnk" /A:C /T:"C:\Path To\file.ext"

CLS
EXIT

----------copy inside only----------

4. Modify the paths accordingly, then paste into Notepad.

5. Save-as AnyName.bat (any name + .bat)

6. Right-click and select "New->Shortcut"

7. Paste the following into the "Type the location of the item" area:
C:\WINDOWS\HSTART.EXE /NOCONSOLE "C:\Path To\AnyName.bat"

8. Give the shortcut a name and run it to test.


ju.c
 

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