Option Explicit Function padLeft(str, length) If Len(str) >= length Then padLeft = str Else padLeft = padLeft("0" + str, length) End If End Function Dim fso,targetfile,c,rarfile,N,Date,WshScript,CurPath,ProjectFolder N = Now Date = CStr(Year(N)) & padLeft(CStr(Month(N)),2) & padLeft(CStr(Day(N)),2) c=2 Set WshScript = CreateObject("WScript.Shell") CurPath = ".\" ProjectFolder = "ProjectName" targetfile = CurPath + ProjectFolder + Date Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(targetfile & ".rar") Then Do while fso.FileExists(targetfile & "_" & c & ".rar") c = c + 1 Loop rarfile = targetfile & "_" & c & ".rar" Else rarfile = targetfile & ".rar" End If Set fso = Nothing WshScript.Run """%ProgramFiles%\WinRAR\WinRAR.exe"" a " + rarfile + " " + CurPath + ProjectFolder Set WshScript = Nothing