/build/static/layout/Breadcrumb_cap_w.png

Replace an existing shortcut for all users

This feels like it should be so simple. But I think I must be doing something wrong.

I am trying to copy a shortcut from a network path to the public desktop folder on all of our desktops. I have tried the following scripts.


Both scripts are launched with

%WINDIR%\System32\cmd.exe

xcopy \\van.com\root\OUTBOX\*.* C:\Users\Public\Desktop /y

xcopy \\van.com\root\OUTBOX\*.* %userprofile%\Desktop /y

Can someone help me out. I am new to KBOX and don't understand what I am doing wrong.

Thank you!!

0 Comments   [ + ] Show comments

Answers (4)

Posted by: snissen 13 years ago
Fourth Degree Green Belt
0
Windows shortcuts are .lnk files, and sometimes they have the hidden attribute set.

XCOPY doesn't copy hidden (or system) files unless you add the /H switch.

But it couldn't be this simple... Sande
Posted by: tsg 13 years ago
Senior Yellow Belt
0
Doesn't look like its that simple : (

I tried running the script with a /H switch. On the test computer the cmd prompt quickly flashes but no Icon is copied to the desktop.

Launch “%WINDIR%\System32\cmd.exe” with params “xcopy \\van.com\root\OUTBOX\*.* %userprofile%\Desktop /Y /H”.

I ran this from an administrative cmd prompt on a test computer manually and it successfully copied the shortcut. It fails to copy through KBOX though.
Posted by: dchristian 13 years ago
Red Belt
0
tsg,

Try running this as a batch script instead of launching a program (cmd).

You can also try using shell scripts for simple stuff like this.

Just make sure you change the script name from script.sh to script.bat.

Hope this helps
Posted by: snissen 13 years ago
Fourth Degree Green Belt
0
Any time you use the Launch program step with cmd.exe, your parms should start with /c like this:
cmd.exe /c xcopy ....
That switch means "run this one command line and then exit". If you forget the /c (I do all the time), your script appears to hang.

Or you can Launch program xcopy.exe directly.

Over the years, I have had problems copying shortcut .lnk files too, so I now create and edit them on the fly using the free Shortcut.exe utility from http://www.optimumx.com/downloads.html . (A colleague uses this free utility's shortcut command: http://www.nirsoft.net/utils/nircmd.html .) Sande
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ