|
-
February 12th, 2010, 08:00 PM
#7
Re: Renaming multiple files in DOS
Once again, try VBSCRIPT
Code:
Const ForReading = 1
strComputer = "."
set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\scripts\names.txt", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
arrParts = Split(strLine, ",")
strFile = "C:\\Pictures\\" & arrParts(0)
Set colItems = objWMIService.ExecQuery _
("Select * From CIM_Datafile Where Name = '" & strFile & "'")
For Each objItem in colItems
strNewName = "C:\Pictures\" & arrParts(1)
objItem.Rename strNewName
Next
Loop
objFile.Close
http://blogs.technet.com/heyscriptin...text-file.aspx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|