如何用代码实现对文件夹权限的控制(添加用户,并完全访问) 如何添加Everyone用户,对该文件夹完全访问? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 哈哈,我搜过不过源码是C++的调用的API函数具体位置忘了现在我用这种方法调用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 WPF:如何Binding到集合中的某一条目数据 如何让窗体显示 C#WinForm 中DateTimePicker控件的极其奇怪的问题 请问如何用oledb连接db文件 gridview中checkbox选中后显示为灰色,刷新后又消失。 各位兄弟,我这样写为什么不对? C#创建Access数据库时如何设置表中字段默认值为空 推箱子的游戏代码是怎么写的 求救啊~~zedgraph鼠标移动并显示相应的X轴和Y轴值鼠标移动的时候,有一条纵轴线跟随鼠标移动,同时显示 请教一个关于web安装项目的问题 在線等...10分 哪位高手用c#写过com组件并成功用vc6调用成功过的????
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