Search code examples
batch-filecallxcopy

Batch file that calls another batch fails to copy files


I have a series of batch files I use when setting up computers. I want to be lazy and instead of running them all individually I want to call them from a single batch file. I have that set up but its not working completely. There is a batch file I CALL that uses XCOPY to move a bunch of shortcuts and icons but it wont copy them when called, only when directly ran.

I've also tried using STARTbut it doesn't run any of the batch files then.

Main Batch, \Post Install\Run.bat

Call "Batch\Shortcuts.bat"

Shortcuts.bat, \Post Install\Batch\Shortcuts.bat

@echo off
@echo Copying Icons And Shortcuts
@echo ................................................................................
xcopy /y /r /v "Shortcuts\Kronos.ico" "C:\Alle-Temp\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\Workday.ico" "C:\Alle-Temp\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\ADMS (New Windchill).url" "C:\Shortcuts\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\ADMS Drawing Lookup.url" "C:\Shortcuts\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\AMMS Web.url" "C:\Shortcuts\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\As-400.lnk" "C:\Shortcuts\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\WorkDay @ Work.lnk" "C:\Shortcuts\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\Kronos @ Work.url" "C:\Shortcuts\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\MapNetworkDrives - G & Q Drives Only.bat" "C:\Shortcuts\"
@echo ................................................................................
xcopy /y /r /v "Shortcuts\McAfee x64.bat" "C:\Users\EsAdmin\Desktop\"
@echo ................................................................................
pause

Solution

  • I believe your solution is:

    Be sure to run this batch file in the same location as all the icons and shortcuts.

    @echo off
    echo Copying Icons And Shortcuts
    echo ................................................................................
    xcopy /y /r /v "Kronos.ico" "C:\Alle-Temp\"
    echo ................................................................................
    xcopy /y /r /v "Workday.ico" "C:\Alle-Temp\"
    echo ................................................................................
    xcopy /y /r /v "ADMS (New Windchill).url" "C:\Shortcuts\"
    echo ................................................................................
    xcopy /y /r /v "ADMS Drawing Lookup.url" "C:\Shortcuts\"
    echo ................................................................................
    xcopy /y /r /v "AMMS Web.url" "C:\Shortcuts\"
    echo ................................................................................
    xcopy /y /r /v "As-400.lnk" "C:\Shortcuts\"
    echo ................................................................................
    xcopy /y /r /v "WorkDay @ Work.lnk" "C:\Shortcuts\"
    echo ................................................................................
    xcopy /y /r /v "Kronos @ Work.url" "C:\Shortcuts\"
    echo ................................................................................
    xcopy /y /r /v "MapNetworkDrives - G & Q Drives Only.bat" "C:\Shortcuts\"
    echo ................................................................................
    xcopy /y /r /v "McAfee x64.bat" "C:\Users\EsAdmin\Desktop\"
    echo ................................................................................
    pause