Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: .bat file to create desktop shortcut  (Read 6516 times)

0 Members and 1 Guest are viewing this topic.

bdb04

  • Guest
.bat file to create desktop shortcut
« on: April 23, 2007, 05:41:31 PM »
Sorry, but it has been a long day, and my brain (apparently) is spent.  I have created a file on our server and I want to send a .bat file to my employees that will create a desktop shortcut on their individual machines. Here is what I have tried:

xcopy s:\common\blah.lnk  c:\docume~1\alluse~1\desktop\blah.lnk /y

and

xcopy s:\common\blah.lnk  c:\docume~1\alluse~1\deskto~1\blah.lnk /y

I have also tried the copy from the s:\ drive using the actual file and copying it as a .lnk and that hasn't worked either.

The file is actually a database, so I don't want to copy the file itself, just the link.

Thanks!!

By the way, our OS is XP if that makes a difference.

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: .bat file to create desktop shortcut
« Reply #1 on: April 23, 2007, 06:42:25 PM »
Maybe this will help:

Code: [Select]
xcopy s:\common\blah.lnk  c:\docume~1\%username%\desktop\blah.lnk /y

Just curious, but why XCOPY? Would not COPY work just as well?

 8)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

bdb04

  • Guest
Re: .bat file to create desktop shortcut
« Reply #2 on: April 24, 2007, 09:19:39 AM »
Hmm, I tried that and it didn't like it either.  I think it has something to do with .lnk files.  I've never tried doing this before with just the shortcut file.  This database is only going to be used for about a month and I was hoping to get away from having to build installation files.

FYI, the only reason I used XCOPY instead of COPY is because of force of habit.  Awhile back I had to set up a program to copy files across our WAN to keep a website updated and it wouldn't work with COPY.  I switched to XCOPY and it worked and I have kind of been using it exclusively since then.

bdb04

  • Guest
Re: .bat file to create desktop shortcut
« Reply #3 on: April 24, 2007, 01:59:18 PM »
As an FYI, I went the MSI route instead.  If anyone does know how to do what I originally asked about, I would be interested in knowing.

Thanks!

viking



    Adviser
  • miaow-miaow 2.0 for networks
  • Thanked: 1
    Re: .bat file to create desktop shortcut
    « Reply #4 on: April 25, 2007, 01:40:05 AM »
    Maybe it would work with some " ".
    So, try something like:
    xcopy s:\common\blah.lnk  "c:\docume~1\alluse~1\desktop\blah.lnk" /y
    or
    xcopy s:\common\blah.lnk "c:\documents and settings\all users\desktop" /y

    bdb04

    • Guest
    Re: .bat file to create desktop shortcut
    « Reply #5 on: April 25, 2007, 09:12:39 AM »
    Hmm, hadn't thought about using " "".  Unfortunately, neither of those ways worked either.  Thanks for the suggestion though!

    viking



      Adviser
    • miaow-miaow 2.0 for networks
    • Thanked: 1
      Re: .bat file to create desktop shortcut
      « Reply #6 on: April 25, 2007, 01:45:33 PM »
      Oh, well... Maybe you need to tell us something else. Like: s: is a network share mapping? And question no 2: what error message do you receive?