Drop into target folder and execute
option explicit Dim fso, folder, file Dim sCurPath, sExtension Dim sOldTargetEnv Dim sNewTargetEnv Dim sNewName ' Where are we sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".") ' Confirm path & get prefix sOldTargetEnv = InputBox("Enter substring to replace e.g. PROD") sNewTargetEnv = InputBox("Enter replacement substring e.g. TEST") if sOldTargetEnv <> "" and sNewTargetEnv <> "" then set fso = CreateObject("Scripting.FileSystemObject") set folder = fso.GetFolder(sCurPath) For Each file In folder.Files sExtension = fso.GetExtensionName(file.Name) ' Ignore this vbs file if ucase(sExtension) <> "VBS" then sNewName = Replace(file.Name, sOldTargetEnv , sNewTargetEnv ) ' Do the rename fso.MoveFile file.Name, sNewName end if Next Set file = Nothing Set folder = Nothing Set fso = Nothing end if