Shell and ShellExecute

I am trying to automate the process of adding new users to an NT server.  Can I run the AddUsers program from ShellExecute in Visual Basic?  Is there a way to use:

Shell("C:\WINNT\system32\CMD.EXE", 1)

and then pass in the args to the command prompt once it is open?  Any suggestions would be much appreciated!!!
lmichalikAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tim HolmanCommented:
You could use Perl to do this sort of thing ?
You can use addusers with csv files to do bulk imports / exports (I think).
What exactly are you trying to achieve ?

0
lmichalikAuthor Commented:
I am creating a Visual Basic app that allows the user to enter the relevant parameters (username, password, group, etc.), and then automatically instantiates that user on the server.  I have already created the interface and am creating a text file that addusers will utilize (containing the relevant info).  

Now I just need to launch the add users program, giving it the info about the text file to use:

addusers /c c:\Users.txt

I have been looking at WinExec, CreateProcess, and Shell & ShellExecute.  I am pretty unfamiliar with API, so I'm unsure of how to proceed.  
0
Brain2000Commented:
You can do this:

Shell("CMD.EXE /C addusers <arguments>")

This will cause CMD.EXE to run the string specified, the close CMD.exe when finished.  Note, you do not need to enclose the command string after /C in quotes, even if it contains spaces.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tim HolmanCommented:
start addusers /c c:\users.txt ?

0
lmichalikAuthor Commented:
Thanks so much!  I couldn't find any specific documentation for the syntax on running this.  You were a great help!  :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Networking

From novice to tech pro — start learning today.