David Eadie wrote:
G'Day all,
I cant for the God in me work out how to execute the following command
line in vb.net: (watch for the word wrapping also)
Sub(ByVal username As String)
Shell("ECHO Y| cacls h:\finance\" & username & "\" & "+Common /G " &
username & ":R", AppWinStyle.Hide, True)
End Sub
I think the problem you're having is that ECHO is not an executable program,
but rather is a function provided by the command prompt itself. This means
you can't directly Shell it as the system doesn't know what it is.
What you can do however is shell the command prompt itself and get it to
execute the ECHO automatically. Try this:
Shell("cmd.exe /C ECHO Y| cacls h:\finance\" & username & "\" & "+Common /G
" & username & ":R", AppWinStyle.Hide, True)
(Again, watch for the wrapping).
The /C switch for the cmd.exe application tells it to execute the statement
provided and then immediately close (for more information, launch a command
prompt and then type "cmd /?" into it).
Hopefully this will do what you want -- but be aware that on Win95/98/Me,
the command processer is actually "command.com" (I think), rather than
"cmd.exe". I don't have access to a Win9x machine at the moment so I don't
know if it supports the same command switch, you'll need to investigate if
it's relevant to what you're doing.
Hope that helps,
--
(O)enone