Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add shortcut to desktop script only if missing

Status
Not open for further replies.

JonCocktoastin

IS-IT--Management
Jan 31, 2003
5
0
0
US
Hello,

I'm trying to get a login script to work that checks to see if a shortcut is on a user's desktop first. Then creates it if necessary. Is there any syntax problems with what I have or is this the wrong approach to take? (2000 client/server)

TIA



@ECHO OFF

IF NOT EXIST "C:\Documents and Settings\%username%\Desktop\app.lnk"
call \\domaincont\netlogon\nss\createshortcuts.exe


IF "%OS%" == "Windows_NT" %0\..\KIX32\KIX32.EXE %0\..\DEPT.SCR

IF "%OS%" == "" Z:\KIX32\KIX32.EXE Z:\DEPT.SCR


PAUSE
 
Why not just push the link out regardless if it is there or not. It is only 1k and will not have an impact on network traffic.

Or try not to use the "Call". Seems that the "Call" is not being performed.

Try this:

@ECHO OFF

IF NOT EXIST "C:\Documents and Settings\%username%\Desktop\app.lnk"
GOTO INSERTLINK

:INSERTLINK
\\domaincont\netlogon\nss\createshortcuts.exe

(you could replace the above line with just the .exe if you put the .exe in C:\WINNT\SYSVOL\sysvol\domainnamehere\scripts if you are using AD"

createshortcuts.exe

IF "%OS%" == "Windows_NT" %0\..\KIX32\KIX32.EXE %0\..\DEPT.SCR

IF "%OS%" == "" Z:\KIX32\KIX32.EXE Z:\DEPT.SCR
GOTO END

:END
@ECHO Shortcuts created.

SOKO ..hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top