An alternative method that allows you to have more complete control over the share creation process is to use a wrapper for the Win32 API. I found one at the following address:
In addition to the methods described above, I have found a way to execute the command that you originally wanted to execute usine Process.Start(). Since the "net share" command is not an application of its own, but is in fact a command that you may issue from within the command console, you must issue the command from within the command console for the command to work. Therefore we must call the "cmd" application and pass it command parameters to have it execute a command and exit the command console upon completion. The code for this follows.
Code:
proc.Start("cmd", "/q /c net share myShare=C:\Temp")
This code should work on NT/2000/XP, but not on Windows 98/ME. Please type "cmd /?" from the command console to see documentation on the command console parameters.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.