Cmd create a user and initialize a new user Desktop

Source: Internet
Author: User
Tags heidisql

Author: skate
Time: 2013/12/20

Function: create a user on win2003 and initialize the desktop of the new user

Echo [InternetShortcut]> MysqlTool. url
Echo URL = C: \ Program Files \ HeidiSQL \ heidisql.exe> MysqlTool. url
Echo IconIndex = 0> MysqlTool. url
Echo IconFile = C: \ Program Files \ HeidiSQL \ heidisql.exe> MysqlTool. url

The file content is as follows:
[InternetShortcut]
URL = C: \ Program Files \ HeidiSQL \ heidisql.exe
IconIndex = 0
IconFile = C: \ Program Files \ HeidiSQL \ heidisql.exe


Then, store the created shortcut file "Mysql Tool" in the following directory (win2003)
C: \ Documents ents and Settings \ Default User \ Desktop \


Or directly create a shortcut
Echo [InternetShortcut]> "C: \ Documents ents and Settings \ Default User \ Desktop \ MysqlTool. url"
Echo URL = C: \ Program Files \ HeidiSQL \ heidisql.exe> "C: \ Documents and Settings \ Default User \ Desktop \ MysqlTool. url"
Echo IconIndex = 0> "C: \ Documents ents and Settings \ Default User \ Desktop \ MysqlTool. url"
Echo IconFile = C: \ Program Files \ HeidiSQL \ heidisql.exe> "C: \ Documents ents and Settings \ Default User \ Desktop \ MysqlTool. url"

Then write the User Creation script adduser. bat. The content is as follows:

@ Echo off
Set/p username = enter the added User Name:
Set/p isuserdel = whether to delete user Y/N if the user exists:
Echo % username %
Net user % username %> nul 2> nul

If "% errorlevel %" = "0 "(
Echo exists for this user
If "% isuserdel %" = "Y "(
Net user % username %/del
Echo user "% username % deleted"
)
) Else (
Echo user does not exist. Creating ....
Net user % username % 111111/add
Net localgroup "Remote Desktop Users" % username %/add
Echo user has been created successfully
)
Echo press any key to exit
Pause & exit

--- End ---

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.