Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Vista Newsgroups > Vista security

permission denied problem

Closed Thread
 
Thread Tools Display Modes
Old 02-18-2008   #1 (permalink)
rac8006
Guest


 

permission denied problem

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
Err.Clear
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
next
str = str & vbcrlf
End Function
set file2 = fso.CreateTextFile("C:\temp\filelst.txt", ForWriting, True)
str = ""
str1 = InputBox("Enter directory?")
Search(str1)
sz = FormatNumber(sz,False,False,-1)
str = str & vbcrlf & "Total bytes " & sz
wscript.Echo str
file2.write(str)
file2.close



Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista and Permission Denied Bill Marshall Vista General 1 02-23-2008 11:22 AM
denied permission jasmineleanne06 Vista account administration 12 01-17-2008 05:47 PM
Denied Permission to Folders WQuinn Vista General 2 06-26-2007 06:14 PM
Permission Denied crossfire Vista account administration 5 05-09-2007 02:50 AM
You have been denied permission to access... P Huebner Vista account administration 12 12-23-2006 09:04 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50