From: PaulM on
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

"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
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
"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

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
>
>