0

我正在尝试向所有人授予文件夹调用 Test 的权限。如果我这样做,它会起作用

objShell.ShellExecute "cmd.exe","/k icacls c:\Test /grant everyone:(OI)(CI)M ", "",  

但如果我这样做,它不会

Set objShell = CreateObject("Shell.Application")
  Dim var
  var = "C:\Test"
  objShell.ShellExecute "cmd.exe", "/k icacls" & var & "/grant everyone:(OI)(CI)M ", "",  "runas", 1

所以我的问题是我怎样才能让它工作请帮忙

4

2 回答 2

1

你忘记了你的空间,将它们包含在你的变量中,比如

var = " C:\Test "

或者更好地预先并将它们附加到字符串的其余部分

objShell.ShellExecute "cmd.exe", "/k icacls " & var & " /grant everyone:(OI)(CI)M ", "",  "runas", 1
于 2013-03-04T22:16:39.057 回答
0

看起来是间距问题。你能试试这个吗?

Set objShell = CreateObject("Shell.Application")
  Dim var
  var = "C:\test"
  objShell.ShellExecute "cmd.exe", " /k icacls " & var & " /grant everyone:(OI)(CI)M ", "",  " runas ", 1
于 2013-03-04T22:16:28.537 回答