windows - Cant find files when copying in batch in administrator mode -
i writing batch file setup small program have written couple of user's machines. batch file writing user's registry run in admin mode. issue have when running in administrator mode when gets copy (i have tested move command) outputs system cannot find file. if run program without admin privileges files copy/move expected. have tested file without registry command seems have no effect on situation. initial files located in folder on users desktop have hard-coded path names in ensure there no confusion. have admin rights onto machine users respective computers. contents of batch file listed below:
rem program needs run administrator add registry rem adds registry value allows user right click document , run program @echo off md %userprofile%\appdata\roaming\microsoft\addins\comparisonaddin copy c:\users\myuser\desktop\launch files\compare.xlsm %userprofile%\appdata\roaming\microsoft\addins\comparisonaddin copy c:\users\myuser\desktop\launch files\launchcompare.bat %userprofile%\appdata\roaming\microsoft\addins\comparisonaddin reg add "hkcr\*\shell\get word difference\command" /v "" /t reg_expand_sz /d "\"%userprofile%\appdata\roaming\microsoft\addins\comparisonaddin\launchcompare.bat\" \"%%1\"" pause the directory created normal in both admin mode , non admin mode. there reason why copy/move command not work in admin mode?
thanks.
copy "c:\users\myuser\desktop\launch files\compare.xlsm" "%userprofile%\appdata\roaming\microsoft\addins\comparisonaddin\" any source or target contains separator characters space, comma, tab etc. must "quoted".
i use trailing backslash @ end of directory name matter of habit if directory not exist, copy won't try create destination file name.
Comments
Post a Comment