用代码实现对文件夹权限的控制
来源:百度文库 编辑:神马文学网 时间:2024/05/01 01:00:49
调用CACLS.EXE程序
Public Function DelFolderUser(ByVal path As String, ByVal UserName As String)
If path.EndsWith("\") Then path = path.Substring(0, path.Length - 1)
Dim CmdTxt As String
CmdTxt = syspath & "Cacls.exe " & path & " /c /e /t /r " & UserName
Shell(CmdTxt, vbHide)
Return True
End Function
Public Function SetFolderUser(ByVal PathName As String, ByVal UserFlag As String, ByVal replace As Boolean) As Boolean
‘Set Change Permissions for the developer using CACLS.exe
If PathName.EndsWith("\") And PathName.Length > 3 Then PathName = PathName.Substring(0, PathName.Length - 1).Trim
‘ PathName = PathName & "\"
Dim strACLCommand As String, objRTC
strACLCommand = " /c echo y|" & syspath & "Cacls.exe "
strACLCommand = strACLCommand & PathName
If replace Then
strACLCommand = strACLCommand & " /c /t /g " & UserFlag
Else
strACLCommand = strACLCommand & " /c /e /t /g " & UserFlag
End If
Dim objWSH
‘Set objWSH = Server.CreateObject("WScript.Shell")
‘objRTC = objWSH.Run(strACLCommand, 0, True)
‘MsgBox(strACLCommand)
Dim INF As ProcessStartInfo = New ProcessStartInfo
INF.FileName = syspath & "cmd.exe "
INF.Arguments = strACLCommand
INF.WindowStyle = ProcessWindowStyle.Hidden
Dim bb As System.Diagnostics.Process = System.Diagnostics.Process.Start(INF)
bb.WaitForExit()
bb.Close()
‘ Shell(strACLCommand, vbHide)
‘Set objWSH = Nothing
Return True
End Function
Public Function DelFolderUser(ByVal path As String, ByVal UserName As String)
If path.EndsWith("\") Then path = path.Substring(0, path.Length - 1)
Dim CmdTxt As String
CmdTxt = syspath & "Cacls.exe " & path & " /c /e /t /r " & UserName
Shell(CmdTxt, vbHide)
Return True
End Function
Public Function SetFolderUser(ByVal PathName As String, ByVal UserFlag As String, ByVal replace As Boolean) As Boolean
‘Set Change Permissions for the developer using CACLS.exe
If PathName.EndsWith("\") And PathName.Length > 3 Then PathName = PathName.Substring(0, PathName.Length - 1).Trim
‘ PathName = PathName & "\"
Dim strACLCommand As String, objRTC
strACLCommand = " /c echo y|" & syspath & "Cacls.exe "
strACLCommand = strACLCommand & PathName
If replace Then
strACLCommand = strACLCommand & " /c /t /g " & UserFlag
Else
strACLCommand = strACLCommand & " /c /e /t /g " & UserFlag
End If
Dim objWSH
‘Set objWSH = Server.CreateObject("WScript.Shell")
‘objRTC = objWSH.Run(strACLCommand, 0, True)
‘MsgBox(strACLCommand)
Dim INF As ProcessStartInfo = New ProcessStartInfo
INF.FileName = syspath & "cmd.exe "
INF.Arguments = strACLCommand
INF.WindowStyle = ProcessWindowStyle.Hidden
Dim bb As System.Diagnostics.Process = System.Diagnostics.Process.Start(INF)
bb.WaitForExit()
bb.Close()
‘ Shell(strACLCommand, vbHide)
‘Set objWSH = Nothing
Return True
End Function
用代码实现对文件夹权限的控制
权限控制的应用程序实现
权限控制的应用程序实现
Proftpd权限控制代码
Subversion之路---实现精细的目录访问权限控制
Subversion实现精细的目录访问权限控制
Linux 系统中的超级权限的控制
Linux 系统中的超级权限的控制
如何实现xp的权限共享
JSP权限控制
基于角色访问控制的权限系统设计
为应用软件加入全面的功能权限控制 - 为应用软件加入全面的功能权限控制-Dephi,教程,...
为应用软件加入全面的功能权限控制 - 为应用软件加入全面的功能权限控制-Dephi,教程,...
对权限系统设计的再思考
Subversion 对中文目录权限的配置
如何设置共享文件夹权限
漫谈权限系统之基于ACL的实现
深入讨论通用权限组件的理论和设计实现。
深入讨论通用权限组件的理论和设计实现。
C#.NET实现文件夹的复制
快速删除文件夹和文件的代码
快速删除文件夹和文件的代码
实例程序实现对CSDN验证码的识别 验证码识别 疯狂代码
用asp实现的代码批量修改程序