How to copy one file to a specific subdirectory in all application data directories in C:\Users? -


one windows 7 x64 trying copy 1 file to

c:\users\profilename\appdata\roaming\autodesk\autocad 2011\r18.1\enu\plotters 

i batch copy file user profiles exist on client pc silently no prompts.

the code have tried far no luck:

@echo off xcopy /i /y "%~dp0myfile.pc3" "c:\users\*\appdata\roaming\autodesk\autocad 2011\r18.1\enu\plotters" 

any ideas on how batch file?

wildcards can't used inside folder path. windows command interpreter support that.

you use following code:

@echo off setlocal enableextensions set "targetpath=appdata\roaming\autodesk\autocad 2011\r18.1\enu\plotters"  rem path of folder containing users' profile folders. /f %%i in ("%public%") set "usersfolder=%%~dpi"  rem copy file subdirectory of each non standard user profile folder. /d %%i in (%usersfolder%*) (     if /i not "%%i" == "%public%" (         if /i not "%%~nxi" == "default" (             if not exist "%%i\%targetpath%\*" md "%%i\%targetpath%"             copy /b /y "%~dp0myfile.pc3" "%%i\%targetpath%\" >nul         )     ) ) endlocal 

the subfolders default , public skipped batch code.

this batch file must of course run administrator otherwise file can copied %appdata%\autodesk\autocad 2011\r18.1\enu\plotters, i.e. appropriate subdirectory in application data directory of autocad 2011 of current user account.

for understanding used commands , how work, open command prompt window, execute there following commands, , read entirely pages displayed each command carefully.

  • copy /?
  • echo /?
  • endlocal /?
  • for /?
  • if /?
  • md /?
  • rem /?
  • set /?
  • setlocal /?

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -