copy a shortcut to all users
hello all-
just checking if anyone have a script of batch file they can share. i am trying to copy a file to all users desktop for windows xp and windows 7.
thanks in advance!
alex
Answers (3)
@echo off
ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp
if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexit
systeminfo | find "OS Name" > %TEMP%\osname.txt
FOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%i
echo %vers% | find "Windows 7" > nul
if %ERRORLEVEL% == 0 goto ver_7
goto warnthenexit
:ver_7
:Run Windows 7 specific commands here.
copy /Y <shortcut file> %public%\Desktop\<filename>
goto exit
:ver_xp
:Run Windows XP specific commands here.
copy /Y <shortcut file> %ALLUSERSPROFILE%\Desktop\<filename>
goto exit
:warnthenexit
echo Machine undetermined.
:exit
Comments:
-
thanks for the info tmlabert13 for the shortcut file location do i type the location where the file resides - brighstarcuit 12 years ago
-
%allusersprofile% will work for both Win 7 and XP. - dugullett 12 years ago
-
dugullet how can i deploy a batch file in kace - brighstarcuit 12 years ago
-
i have the batch file in place how can i run this in kace @echo off
:ver_xp and 7
:Run Windows XP specific commands here.
copy /Y C:\teller.lnk %ALLUSERSPROFILE%\Desktop\teller.lnk
goto exit
:exit - brighstarcuit 12 years ago -
have any of you guys push a batch file using kace - brighstarcuit 12 years ago
-
Upload the batch as a dependency. Use the task "Launch a program" with the location of: $(KACE_DEPENDENCY_DIR)\yourbatch.bat.
Also use a verify step that shows the shortcut has been deployed, otherwise the script will keep running. - jknox 12 years ago-
you good at scripting right will this script work
'===========
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objProcess = objShell.Environment("Process")
strDesktop = objProcess.Item("UserProfile") & "\Desktop\"
boolOverwrite = False
objFSO.CopyFile "\\server\share\shortcut.lnk", strDesktop, boolOverwrite
'========== - brighstarcuit 12 years ago
-
on sucess
launch: a program
directory: $(KACE_SYS_DIR)
file:
parameters $(KACE_DEPENDENCY_DIR)\teller.bat
what do i use for the file and how can i verify the shortcut is in place
thanks - brighstarcuit 12 years ago
I'd just use a script that unzips the shortcuts into place.
Use the verify task to determine XP by verifying that C:\Documents and Settings exists, then use on success to unzip your shortcut to C:\Documents and Settings\All Users\Desktop.
Use remediation to unzip the shortcut to C:\Users\Public\Desktop\ for Win7.
Comments:
-
hey jknox for Remediation what do i put for the Directory: - brighstarcuit 12 years ago
-
You will probably have to map the file location on the machine by using $(KACE_DEPENDENCY_DIR) - jknox 12 years ago
There's always the desktop shortcut wizard under Scripting->Configuration Policy too.
Not 100% sure if this does all users though.
Comments:
-
tthat wizard can only copy to the current logon user - brighstarcuit 12 years ago