Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Script
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
PaulM  
View profile  
 More options Nov 6 2009, 9:08 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "PaulM" <N...@NONO.COM>
Date: Fri, 6 Nov 2009 16:08:28 -0500
Local: Fri, Nov 6 2009 9:08 pm
Subject: Re: Script
Thanks

"Richard Mueller [MVP]" <rlmueller-nos...@ameritech.nospam.net> wrote in
message news:OreMP6mXKHA.412@TK2MSFTNGP04.phx.gbl...

> "PaulM" <N...@NONO.COM> wrote in message
> news:OORp6rmXKHA.220@TK2MSFTNGP02.phx.gbl...
>> Why does this script work:

>> ' Description: Demonstration script that uses the FileSystemObject to
>> delete a file. Local computer
>> ' For Vista

>> Set WSHShell = WScript.CreateObject("WScript.Shell")
>> Set objFSO = CreateObject("Scripting.FileSystemObject")

>> objFSO.DeleteFile("F:\Users\TestUser\AppData\Local\test.vbs")

>> And this script does not work:

>> ' Description: Demonstration script that uses the FileSystemObject to
>> delete a file. Local computer
>> ' For Vista

>> Dim Windir
>> Dim Users
>> Dim UserProfile
>> Dim AppData
>> Dim Local

>> Set WSHShell = WScript.CreateObject("WScript.Shell")
>> Set objFSO = CreateObject("Scripting.FileSystemObject")
>> Windir = WshShell.ExpandEnvironmentStrings("%SystemRoot%")
>> Users =  WshShell.ExpandEnvironmentStrings("%Users%")
>> UserProfile = WshShell.ExpandEnvironmentStrings("%UserProfile%")
>> AppData = WshShell.ExpandEnvironmentStrings("%AppData%")
>> Local = WshShell.ExpandEnvironmentStrings("%Local%")

>> objFSO.DeleteFile("%SystemRoot%\%Users%\%UserProfile%\%AppData%\%Local%\tes t.vbs")

> Check out the LocalAppData environment variable. Also, once you retrieve
> the value of the environment variable and assign it to a variable, use the
> variable. For example, try:
> ========
> Dim LocalAppData, WshShell, objFSO

> Set WshShell = CreateObject("Wscript.Shell")
> Set objFSO = CreateObject("Scripting.FileSystemObject")

> LocalAppData = WshShell.ExpandEnvironmentStrings("%LocalAppData%")

> objFSO.DeleteFile(LocalAppData & "\test.vbs")
> =========
> You can troubleshoot with statements similar to:

>  Wscript.Echo LocalAppData & "\test.vbs"

> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google