Login scripts - Powerpoint

419 Views Asked by At

I have a simple login script that will pull another .bat where it will point to our powerpoint template.

Problem is, whenever I use the below, I always get a popup on the second instance which is meant to be hidden, as you can see -y doesn't hide it. I've tried a min before xcopy but that causes errors and my knowledge of this is rather limited.

Below is the code:

login script:

@echo off
REM Copy Powerpoint default template to user profile

xcopy "\\wsfile01\AppData\Microsoft Office Templates\Blank.potx" "\\nebula\public\Ldn_town\%username%\AppData\Roaming\Microsoft\Templates" /Y 

exit

I appreciate that we are copying from network to network and this may seem daft but all our profiles sit on a local server for each satellite office.

Any help would be much appreciated.

2

There are 2 best solutions below

0
SomethingDark On

You can pass a Y to the xcopy command via echo which will simulate entering Y yourself.

@echo off
echo y | xcopy "\\wsfile01\AppData\Microsoft Office Templates\Blank.potx" "\\nebula\public\Ldn_town\%username%\AppData\Roaming\Microsoft\Templates"
0
Mofi On

For copying a single file usually copy is used instead of xcopy as when executed from within a batch file the target file is automatically overwritten, except the target file has read-only attribute set.

@copy "\\wsfile01\AppData\Microsoft Office Templates\Blank.potx" "\\nebula\public\Ldn_town\%username%\AppData\Roaming\Microsoft\Templates"

In case of target file already exists with read-only attribute set, usage of command xcopy with the parameters /R /Y is better.

@xcopy "\\wsfile01\AppData\Microsoft Office Templates\Blank.potx" "\\nebula\public\Ldn_town\%username%\AppData\Roaming\Microsoft\Templates" /I /R /Y