permission denied problem

Posted: 02-18-2008, 11:43 PM
I'm new to vista and vbscript. But I created the following script to display
the size of folders in a directory.

When I run the program from a cmd window that has been started with run as
administrator it get permission denied on the c:\windows\system32 directory
when I enter c:\windows. If I enter c: the users and windows directories get
permission denied. I also get the same problem if I login as administrator.
What am I doing wrong?
I used the following vbscript:
Const ForWriting = 1
Dim arrHeaders(48),fso,ts,file2
Int sz
Set fso = CreateObject("Scripting.FileSystemObject")
Sub ShowFolderSize(filespec)
On Error Resume Next
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(filespec)
n = int(f.size)
If Err.Number <> 0 Then
MsgBox Err.Number & ": " & Err.Description & filespec
End If
sz = sz + n
n = FormatNumber(n,False,False,-1)
s = UCase(f.Name) & Space(30 - Len(f.Name)) & "uses " & Space(18-Len(n))
& n & " bytes."
str = str & s & vbcrlf
End Sub
Function Search(Dir)
Set objShell = CreateObject("Shell.Application")
Set objfolder = objShell.Namespace(Dir)
For Each strFileName in objFolder.Items
If fso.FolderExists(Dir & "\" & strFileName) = True Then
ShowFolderSize(Dir & "\" & strFileName)
End If
str = str & vbcrlf
End Function
set file2 = fso.CreateTextFile("C:\temp\filelst.txt", ForWriting, True)
str = ""
str1 = InputBox("Enter directory?")
sz = FormatNumber(sz,False,False,-1)
str = str & vbcrlf & "Total bytes " & sz
wscript.Echo str

permission denied problem

Responses to "permission denied problem"

LinkBack Thread Tools Display Modes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
denied permission jasmineleanne06 Windows Vista Administration 12 01-17-2008 11:47 PM
Permission Denied crossfire Windows Vista Administration 5 05-09-2007 07:50 AM
Permission Denied to an Administrator Peter Dunoon Windows Vista Administration 2 03-28-2007 03:40 AM
WMI Permission denied dwos Windows XP WMI 3 10-22-2004 06:38 PM
Access denied no permission Don Starr Windows XP Accessibility 1 07-30-2003 09:58 PM