
Using variables in WshShell.Run ("....")
"Rolf Rettinger" wrote ...
Quote:
> How can I use my variables HomeDIr, UserID within the statement below:
> I tried the code below, but this will end always with an error!
> Set WshShell = CreateObject("WScript.Shell")
> WshShell.Run ("%windir%\system32\cacls" & HomeDir & "\" & UserID & "/E
> /G tarsom-eu\" & UserID & ":F")
What error? You need to provide a little more information before anyone can
give you a definite reason...
If that is indeed the exact code you are using, however, I can spot at least
two problems from here (well, the same problem twice, anyway...) - there
should be a space after "cacls", and another before the "/E".
If that's not the problem, try just outputting the string inside the
brackets ("%windir%...:F") without passing it to WshShell.Run (e.g. using
MsgBox()), and looking at what get's displayed - you'll probably find
there's something fairly obviously wrong with the command-string.
hth hand
Adam