Thus, C:\Scripts\Test.txt ends up as C:\\Scripts\\Test.txt. That’s because the \ is a reserved character in WMI one of the consequences of being a reserved character is that any time we use the \ in a Where clause we need to “escape” the character, which simply means we need to preface any \ in the path with a second \. No, we haven’t been drinking (why does everyone always assume that?) we really do need to indicate the path as C:\\Scripts\\Test.txt. #FILE RENAMING SOFTWARE FROM EXCEL FILE LIST CODE#What’s that? What if you want to bind to the WMI service (and to a file) stored on a remote computer? No problem just assign the variable strComputer the name of that remote machine: strComputer = “atl-fs-01”Īfter we connect to the WMI service we then use this line of code to bind to the file C:\Scripts\Test.txt: Set colFiles = objWMIService. To do that, we assign the value dot (.) to a variable named strComputer in a minute we’ll use this variable to connect to the WMI service on the local computer. We start out with some basic WMI code that binds us to the file we want to copy. StrNewName = objExcel.Cells(intRow, 1).Value Set objWorkbook = (“C:\Scripts\Names.xls”)ĭo Until objExcel.Cells(intRow,1).Value = “” Set objExcel = CreateObject(“Excel.Application”) Set objWMIService = GetObject(“winmgmts:\\”
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |