I have a .exe file in C:\DOCUME~1\user\Local Settings\Apps\2.0\....../some flder(changes everytime)
I want to copy it to C:\Program FIlesThis is what i have done
set SearchIn=%userprofile%
set FileToSearch=dd.exe
:begin
cd "%SearchIn%"
attrib /s \dd.exe
IF EXIST dd.exe copy "%FileToSearch%" "C:\Program Files"
rem dd.exe somename.exeif not %ErrorLevel% == 0 echo some error, errorlevel is %ErrorLevel% & pause
:end
Please help me make it sucessful
one way, if dd.exe only exists in one location:
xcopy /s dd.exe "c:\program files"
if %errorlevel% equ 4 echo file dd.exe not foundanother way, using your attrib approach (but "dir" instead):
for /f "tokens*" %%a in ('dir /b /s dd.exe') do set xx=%%a
if not defined xx (echo file not found) else (copy %%a "c:\program files")
Hey nbrane Thanks for the reply but it didn't work either.i have tried using the dir command every time in install this program it installs itself in a different folder in the user profile ..i need to copy it to program files to make it available to all the users and rename it for proper functionality
Any other ideas.....?.
I am a newbie in bat scripting so complete script would be of great help
well, with the /s on the dir, it should work, as should the xcopy /s which, although aimed at copying entire directory-structures, will also work for single-file copy of a file located "downstream" in the dir.structure.
attrib /s could be used, but you gotta monkey around with it more.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |