cooper Posted November 21, 2019 Posted November 21, 2019 Hi I am trying to run this script at startup via GPO I can get it to run the second xcopy line and can get the if exists to work. But when I add the xcopy for the desktop shortcut it will run if I manually test the script but not the GPO Startup @echo off Copy Minetest folder to C from FS01 if exist "%userprofile%\Desktop\Minetest.lnk" goto end xcopy "\\fs01\SoftwareDrivers\Software\Minetest Script\Minetest.lnk" "%userprofile%\Desktop" /s /i xcopy "\\fs01\SoftwareDrivers\Software\Minetest" "c:\Minetest" /s /i exit
ChrisMiles Posted November 21, 2019 Posted November 21, 2019 (edited) Among other errors, you are saying goto end but you don't have an end label so it will error out if the file exists and you're not checking the other folder exists. @ECHO OFF ::Copy Minetest folder to C from FS01 IF EXIST "%userprofile%\Desktop\Minetest.lnk" GOTO SKIP1 xcopy "\\fs01\SoftwareDrivers\Software\Minetest Script\Minetest.lnk" "%userprofile%\Desktop" /s /i :SKIP1 IF EXIST "c:\Minetest" GOTO SKIP2 xcopy "\\fs01\SoftwareDrivers\Software\Minetest" "c:\Minetest" /s /i :SKIP2 You can use a GPO to place this file though, it will be a lot cleaner. Edited November 21, 2019 by ChrisMiles 2
cooper Posted November 21, 2019 Author Posted November 21, 2019 Thanks, I have never copied files using GPO before. Will have a look
Davit2005 Posted November 21, 2019 Posted November 21, 2019 As a test can you pre-create a folder on the c drive and change the xcopy to copy the file to the folder? 1
cooper Posted November 21, 2019 Author Posted November 21, 2019 I have tried the amended script and it will only work manually. Also tried GPO to copy the desktop shortcut and this failed.
clydey10 Posted November 21, 2019 Posted November 21, 2019 (edited) I have tried the amended script and it will only work manually. Also tried GPO to copy the desktop shortcut and this failed. Your script looks to be copying the icon to the user profile desktop. You may need to use %public%\desktop or c:\users\public\desktop if you want it on all users desktop. If you are wanting the icon on the user profile desktop then you need to run as a login script rather than startup script, or use group policy preferences. Edited November 21, 2019 by clydey10 1
cooper Posted November 21, 2019 Author Posted November 21, 2019 Thanks alot for you help guys. I have changed the script to use c:\users\public\desktop and its working.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now