Jump to content

Net User

Recommended Posts

I have declared a Global variable $username

I then prompt from an input for a username:

$username = Inputbox("Username", "Please enter in the assigned user name", "", "", -1, 100)

The OS is Windows XP.

I want to use the net user /add $username. I did see a prior posting on the use of the 'net use' command. I have attempted to simulate the command line but have had no success. Any help would be great!

Link to post
Share on other sites

Thanks Larry.

I get error code = 1. Yikes.

I'm just not seeing the error in the syntax. I used the %COMSPEC% /c in Autoitv2 with no errors. I have tried using the @COMSPEC in v3 but still have issues. I have been successful hard coding the username in rather then using the defined variable $username, but that of course defeats my purpose.

Any Ideas? Much appreciated Larry.

Link to post
Share on other sites
  • Developers

what happens when you try:

$a = RunWait(@comspec & " /c net user " & $username & " /add")
If $a Then MsgBox(4096,"ERROR","You received error " & $a)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

Link to post
Share on other sites

This is seriously the best forum I have ben on yet. Answers in seconds!

Well, it was my syntax. I was unaware that my actual spacing in the code would come into play.

JdeB - I followed your syntax exactly and got it to work. I had tried this exact syntax before with little regard for spacing between " and &.

JdeB & Larry ------- thanks again

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...