Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rename file with blank characters in file name batch

Status
Not open for further replies.

kerbaule

IS-IT--Management
Dec 29, 2003
24
FR
Bonjour,

I need to rename file with blank characters in file name
This command need to be run in batch mode, so without any
display on screen .

Could someone give me a vbscript to do this ?
many thanks

E.kerbaul
 
' Replaces all the blanks in the filename in a folder with "_"

'the folder where the files are stored
Const Map = "C:\Scripts\SearchBlanks"

Set ObjFileSystem = CreateObject("Scripting.FileSystemObject")
Set Folder = ObjFileSystem.GetFolder(Map)
Set Bestanden = Folder.Files

For Each Bestand In Bestanden
If InStr(Bestand.Name, " " ) > 0 Then
Bestand.Name = Replace(Bestand.Name, " ", "_")
End If
Next

Set Bestanden = Nothing
Set Folder = Nothing
Set ObjBestandSysteem = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top