Microsoft Windows Vista Community Forums - Vistaheads
Recommended Download



Welcome to the Microsoft Windows Vista Community Forums - Vistaheads, YOUR Largest Resource for Windows Vista related information.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so , join our community today!

If you have any problems with the registration process or your account login, please contact us.

Driver Scanner

permission denied problem

microsoft.public.windows.vista.security






Speedup My PC
Reply
  #1 (permalink)  
Old 02-19-2008
rac8006
 

Posts: n/a
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



Reply With Quote
Sponsored Links
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Permission Denied to an Administrator =?Utf-8?B?UGV0ZXIgRHVub29u?= microsoft.public.windows.vista.administration accounts passwords 3 10-07-2009 03:23
denied permission jasmineleanne06 microsoft.public.windows.vista.administration accounts passwords 12 01-18-2008 00:47
Denied Permission to Folders WQuinn microsoft.public.windows.vista.general 2 06-27-2007 00:14
Permission Denied crossfire microsoft.public.windows.vista.administration accounts passwords 5 05-09-2007 08:50
Re: You have been denied permission to access... =?Utf-8?B?RmF5Y2Fs?= microsoft.public.windows.vista.administration accounts passwords 2 02-28-2007 14:10




All times are GMT +1. The time now is 07:51.




Driver Scanner - Free Scan Now

Vistaheads.com is part of the Heads Network. See also XPHeads.com , Win7Heads.com and Win8Heads.com.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.0 RC 2

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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120