简体   繁体   中英

Batch script to copy folder not working

I wish to setup a batch file to copy a folder (from the same location of the batch file) to the Microsoft folder in C:\\Users\\username\\AppData\\Roaming to be used by Outlook for email signatures.

The batch file currently looks like:

@echo off

ROBOCOPY \Files "%userprofile%\AppData\Roaming\Microsoft" /COPYALL /MIR
regedit.exe /s Setup-File-Linking.reg

It imports the registry setting fine, but does not copy the "Signatures" folder across.

I have the wrong source path. How do I make it relative to where the script is being run from?

In the folder where the batch file is run from, the file structure looks like:

FOLDER
|- Run Me!.bat
|- Setup-File-Linking.reg
|- Files *(dir)*
   |- Signatures *(dir)*
      |- emailsignature.htm
      |- emailsignature.rtf
      |- emailsignature.txt
      |- emailsignature_files *(dir)*
         |- colorschememapping.xml
         |- filelist.xml
         |- themedata.thmx
___

.

--- EDIT ---

I added pause to the end of my script to see any errors. A screenshot is below. I've edited my question above to suit.

在此处输入图片说明

Try adding the /S option to the ROBOCOPY command. See ROBOCOPY /?

Replace the source (\\Files) with "%CD%\\Files" I think you still need the /S

Added 9/19/2014 To verify that the user has admin privileges you can do something like this.

REM Do OPENFILES to verify that user has administrative privileges
OPENFILES >nul 2>nul
IF ERRORLEVEL 1 (
  COLOR CF
  ECHO.You must run this program as administrator
  PAUSE
  GOTO :eof
  )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM