hello everyone!
I've read about 30pages in there and i still havent found a solution to a problem i have, so i thought i'll ask!
anyway...here is what it's all about :
I have a bat file for backing up outlook files!
When i launch it, it close outlook.exe, then copy the .pst to another drive and if outlook.pst already exist it renames it to outlook(1).pst and so on
Everything works
perfectly fine on XP but I have to make it works with Win7 Pro 64 and it doesn't!
When i launch it on 7, it copy the file just fine but if it already exists, it renames it to outlook(1).pst and keep on overwriting it instead of going on with the (2) (3) (4)
I also tried the "run as win xp" and "run as admin" but no luck.
Here is my batch, i really hope someone can help me figure it out!
*********batch********
taskkill /im Outlook.exe
@ping 127.0.0.1 -n 2 -w 1000 > nul
@ping 127.0.0.1 -n 2 -w 1000 > nul
setlocal EnableDelayedExpansion
set DestFolder=D:\test\Finished
md "%DestFolder%" 2> nul
for /r "C:\Users\steffy\AppData\Local\Microsoft\Outlook" %%f in (Outlook.pst) do (
set CanCopy=false
set folder=%%~pf
for %%x in ("!folder:~0,-1!") do set folder=%%~nx
if /i "!folder!" neq "%DestFolder%" if /i "%%f" neq "%~dpnx0" (
set CanCopy=true
)
if "!CanCopy!" equ "true" (
if exist "%DestFolder%\%%~nxf" (
call :GetNextFilename "%DestFolder%\%%~nxf" newfile
copy "%%f" "%DestFolder%\!newfile!"
) else (
copy "%%f" "%DestFolder%\"
)
)
)
goto :eof
:GetNextFilename
set n=0
:loop
set /a n+=1
set %2=%~n1(%n%)%~x1
if exist "%~p1!%2!" goto loop
goto :eof
THANKS!