Windows Vista Forums

Error
  1. #1


    PaulM Guest

    Error

    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



      My System SpecsSystem Spec

  2. #2


    Todd Vargo Guest

    Re: Error


    "PaulM" <paul@xxxxxx> wrote in message
    news:uzv4iHQzIHA.3920@xxxxxx

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


      My System SpecsSystem Spec

  3. #3


    PaulM Guest

    Re: Error

    That worked. Thanks.


    "Todd Vargo" <tlvargo@xxxxxx> wrote in message
    news:OvP$msQzIHA.4004@xxxxxx

    >
    > "PaulM" <paul@xxxxxx> wrote in message
    > news:uzv4iHQzIHA.3920@xxxxxx

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

      My System SpecsSystem Spec

  4. #4


    Stefan Kanthak Guest

    Re: Error

    "Todd Vargo" <tlvargo@xxxxxx> 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


      My System SpecsSystem Spec

  5. #5


    ThatsIT.net.au Guest

    Re: Error


    "Stefan Kanthak" <postmaster@[127.0.0.1]> wrote in message
    news:OTniRYVzIHA.3496@xxxxxx

    > "Todd Vargo" <tlvargo@xxxxxx> 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
    >
    What version of windows will his script not work on, where yours will?


      My System SpecsSystem Spec

  6. #6


    PaulM Guest

    Re: Error

    OK lets start over, how would you do this script?
    set WshShell = WScript.CreateObject("WScript.Shell")
    dFolder = WshShell.ExpandEnvironmentStrings("%UserProfile%") & _
    "\appData\Roaming\Microsoft\Windows\cookies"

    Set fso = CreateObject("Scripting.FileSystemObject")

    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

    "Stefan Kanthak" <postmaster@[127.0.0.1]> wrote in message
    news:OTniRYVzIHA.3496@xxxxxx

    > "Todd Vargo" <tlvargo@xxxxxx> 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
    >

      My System SpecsSystem Spec

  7. #7


    mayayana Guest

    Re: Error

    >

    >
    > WScript.CreateObject("Shell.Application").NameSpace(21).Self.Path
    >
    This may not matter to most people, but the
    Self property was not introduced until Win2000
    or WinME. I'm not sure which. If any older shell
    versions might be involved it's safer to use the
    parent folder's path.



      My System SpecsSystem Spec

Error problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when sending e-mail (error in outbox) Error ID: 0x80191002 Stefano Live Mail 1 10 Mar 2010
no,socket Error: 11003. Error Number: 0x800CC0D cant i send email name is correctly benitocuervo Vista mail 1 31 Oct 2008
Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F ThatsIT.net.au Vista mail 1 09 Mar 2008
Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F ThatsIT.net.au Vista General 0 09 Mar 2008
windows live mail 2008 (Build 12.0.1606) error report error gbp007 Windows Live 13 24 Jan 2008