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

Author Topic: OR Command (or similar)  (Read 2088 times)

0 Members and 1 Guest are viewing this topic.

bsaff

  • Guest
OR Command (or similar)
« on: January 08, 2007, 09:21:28 AM »
Hello hopers,

I'm trying to set up a batch file for login script on SBS 2003.
What I really want to do is set it up so that the script will put a standard set of shortcuts onto users desktops if they dont already have them.
The problem I have is that different users have several different names for their Outlook shortcut, therefore my
IF NOT EXIST "%userprofile%\desktop\Microsoft Office Outlook.lnk". (copy "[location of link]" "%userprofile%\desktop".) code doesnt guarantee against users getting multiple outlook shortcuts on their desktop.

Is there an OR command I can use so that the .bat looks for several different shortcut names before creating a new one, or is there an alternative way to code the .bat for shorcuts (perhaps by target rather than file name).

Cheers guys

Ben (noob)

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: OR Command (or similar)
« Reply #1 on: January 08, 2007, 02:38:52 PM »
You can piggyback commands in batch code so only one of a series of statements get executed.

Code: [Select]
if condition1 do something1 & goto skip
if condition2 do something2 & goto skip
if condition3 do something3 & goto skip
:skip

I'll leave it to you to decide who gets what Outlook shortcut. 8-)
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

bsaff

  • Guest
Re: OR Command (or similar)
« Reply #2 on: January 09, 2007, 04:36:04 AM »
I couldnt get your method to work, but I modified it a bit using the GOTO SKIP command to create:

IF EXIST "%userprofile%\desktop\Microsoft Office Outlook.lnk"       GOTO SKIP
IF EXIST "%userprofile%\desktop\EMAIL.lnk"            GOTO SKIP
etc...
etc...

copy "[shortcut location]" "%userprofile%\desktop"

:SKIP

et voila, it works

Cheers for pointing me in the right direction