|
From: PaulM on 12 Jun 2008 23:02 Why does this give me a error, path not found? This is a script for Vista. Set fso = CreateObject("Scripting.FileSystemObject") dFolder = "%UserProfile%\appData\Roaming\Microsoft\Windows\cookies" Set Fldr = fso.GetFolder(dFolder) For each file in Fldr.files If Ucase(Left(File.Name, 6)) = "COOKIE" Then wscript.echo file fso.DeleteFile(file) End if wscript.echo file Next
From: Todd Vargo on 13 Jun 2008 00:00 "PaulM" <paul(a)paulsxp.com> wrote in message news:uzv4iHQzIHA.3920(a)TK2MSFTNGP02.phx.gbl... > Why does this give me a error, path not found? > This is a script for Vista. > > > Set fso = CreateObject("Scripting.FileSystemObject") > dFolder = "%UserProfile%\appData\Roaming\Microsoft\Windows\cookies" > > Set Fldr = fso.GetFolder(dFolder) > For each file in Fldr.files > If Ucase(Left(File.Name, 6)) = "COOKIE" Then > wscript.echo file > fso.DeleteFile(file) > End if > wscript.echo file > Next You have to use ExpandEnvironmentStrings method to retrieve %UserProfile% from the environment. Try this... set WshShell = WScript.CreateObject("WScript.Shell") dFolder = WshShell.ExpandEnvironmentStrings("%UserProfile%") & _ "\appData\Roaming\Microsoft\Windows\cookies" -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages)
From: PaulM on 13 Jun 2008 00:59 That worked. Thanks. "Todd Vargo" <tlvargo(a)sbcglobal.netz> wrote in message news:OvP$msQzIHA.4004(a)TK2MSFTNGP03.phx.gbl... > > "PaulM" <paul(a)paulsxp.com> wrote in message > news:uzv4iHQzIHA.3920(a)TK2MSFTNGP02.phx.gbl... >> Why does this give me a error, path not found? >> This is a script for Vista. >> >> >> Set fso = CreateObject("Scripting.FileSystemObject") >> dFolder = "%UserProfile%\appData\Roaming\Microsoft\Windows\cookies" >> >> Set Fldr = fso.GetFolder(dFolder) >> For each file in Fldr.files >> If Ucase(Left(File.Name, 6)) = "COOKIE" Then >> wscript.echo file >> fso.DeleteFile(file) >> End if >> wscript.echo file >> Next > > You have to use ExpandEnvironmentStrings method to retrieve %UserProfile% > from the environment. > > Try this... > > set WshShell = WScript.CreateObject("WScript.Shell") > dFolder = WshShell.ExpandEnvironmentStrings("%UserProfile%") & _ > "\appData\Roaming\Microsoft\Windows\cookies" > > -- > Todd Vargo > (Post questions to group only. Remove "z" to email personal messages) >
From: Stefan Kanthak on 13 Jun 2008 09:02 "Todd Vargo" <tlvargo(a)sbcglobal.netz> wrote: Your address is wrong! [ very clumsy way to get the cookie jar ] > You have to use ExpandEnvironmentStrings method to retrieve %UserProfile% > from the environment. > > Try this... > > set WshShell = WScript.CreateObject("WScript.Shell") > dFolder = WshShell.ExpandEnvironmentStrings("%UserProfile%") & _ > "\appData\Roaming\Microsoft\Windows\cookies" That's clumsy too! And on Vista AFAIK %LocalAppData% has been introduced, so it is advisable to use that environment variable in REAL batch scripts. WScript.CreateObject("Shell.Application").NameSpace(21).Self.Path is THE on and only way to retrieve the location of the current users cookie folder on all versions and all languages of Windows. Stefan
From: ThatsIT.net.au on 13 Jun 2008 11:32 Const USER_PROFILE = &H28& Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(USER_PROFILE) Set objFolderItem = objFolder.Self dFolder = objFolderItem.Path & "\appData\Roaming\Microsoft\Windows\cookies" "PaulM" <paul(a)paulsxp.com> wrote in message news:uzv4iHQzIHA.3920(a)TK2MSFTNGP02.phx.gbl... > Why does this give me a error, path not found? > This is a script for Vista. > > > Set fso = CreateObject("Scripting.FileSystemObject") > dFolder = "%UserProfile%\appData\Roaming\Microsoft\Windows\cookies" > > Set Fldr = fso.GetFolder(dFolder) > For each file in Fldr.files > If Ucase(Left(File.Name, 6)) = "COOKIE" Then > wscript.echo file > fso.DeleteFile(file) > End if > wscript.echo file > Next > >
|
Next
|
Last
Pages: 1 2 Prev: help needed moving mulitple computer accounts Next: Install a Printer (WMI) Access denied |