I have a file in my home direcoty on the network in my z:\. it is located 2 subdirectories down z:\somedir\somsubdir\someuser.id (it is a notes id file and is based on the network username). I have to rename it specifically to user.id
when i run this script, i want the script to look for a file name based on "%username% & .id" and then rename it to user.id.
Here is the example of the code:
set wshshell = createobject("wscript.shell")
strcomputer = "."
Set objWMIService = GetObject _
("winmgmts:" & "!\\" & strComputer & "\root\cimv2")
username = wshshell.expandenvironmentstrings("%USERNAME%")
useridfile = (username & ".id")
wscript.echo username
wscript.echo useridfile
set notefileren = objwmiservice.execquery _
("Select * from CIM_DataFile where Name = " _
& "'z:\\somedir\\somesubdir\\useridfile'")
For Each fileobj in notefileren
fileobj.Rename("j:\Notes\Data\user.id")
next
Any suggestions would be greatly appreciated
when i run this script, i want the script to look for a file name based on "%username% & .id" and then rename it to user.id.
Here is the example of the code:
set wshshell = createobject("wscript.shell")
strcomputer = "."
Set objWMIService = GetObject _
("winmgmts:" & "!\\" & strComputer & "\root\cimv2")
username = wshshell.expandenvironmentstrings("%USERNAME%")
useridfile = (username & ".id")
wscript.echo username
wscript.echo useridfile
set notefileren = objwmiservice.execquery _
("Select * from CIM_DataFile where Name = " _
& "'z:\\somedir\\somesubdir\\useridfile'")
For Each fileobj in notefileren
fileobj.Rename("j:\Notes\Data\user.id")
next
Any suggestions would be greatly appreciated