Summary of My DOS Command
1. Findstr // Searches for strings in files
A) Findstr/s/m "bruce" *. * // searches for "bruce" in all files
B) Findstr "bruce there" x. y // searches for "bruce" or "there" in file x. y.
C) Findstr/C: "bruce there" x. y // searches for "bruce there" in file x. y.
/S Searches for matching files in the current directory and all subdirectories.
/M Prints only the filename if a file contains a match.
2. Xcopy // Copies files and directory trees.
Xcopy "" brucepc "Courses" *. */s/y // copy all files of courses
/S Copies directories and subdirectories should t empty ones.
/Y Suppresses prompting to confirm you want to overwrite
Existing destination file.
3. Start // Starts a separate window to run a specified program or command.
Start C: "Windows
4. ipconfig/all // Show detailed information such as IP address, subnet mask and default gateway for each adapter bound to TCP/IP.
5. ping IP // for check net status
6. shutdown/r/t 0 // restart immediately
Shutdown/s/t 0 // shutdown immediately,
/R Shutdown and restart the computer.
/S Shutdown the computer
7. cd "// go to root directory
8. pushd // Stores the current directory for use by the POPD command, then changes to the specified directory.
9. popd // Changes to the directory stored by the PUSHD command
10. regedit/s 1.reg // automate import reg file and no hint
11. net use // list local network connections
A) net use "" IP "ipc $" password "/user:" Account "creates an IPC with the specified IP address $ (empty connection)
Net use z: "" IP "c $" password "/user:" Account "ing the c disk of the other party to its own z Disk
Net use "" IP "ipc $/del Delete the IPC $ connection with the specified IP Address
Net use z:/del Delete the z disk mapped to the Local Machine
Net use */del Delete All mappings on the local machine and IPC $ connections
As prompted: The creden provided conflict with the existing creden. net use */del is enough.
B) Remote: net use "" computername "sharename" password "/user:" administrator"
12. net user view local users
A) net user abcd 1234/add: create an account with the username abcd and password 1234. The default account is a member of the user group.
B). net user abcd/del: Delete the user whose user name is abcd.
C) net user abcd/active: no. Disable the user whose user name is abcd.
D) net user abcd/active: yes. Activate the user whose user name is abcd.
Net user abcd, view the situation of users whose user name is abcd
13. net localgroup administrators user name/add the user to the Administrator
Net localgroup administrators user name/del delete a user from the Administrator Group
13. net start service name // enable the service. (For example, net start telnet, net start schedule)
Net stop service name // stop a service
14. net view "" ip Address: view which shares are enabled in the Peer LAN
15. net share
A) net share ipc $ enable ipc $ share
B) net share ipc $/del Delete ipc $ share
C) net share c $/del Delete C: share
16. Run the nslookup command to check whether the DNS server is working properly.
17. net helpmsg // provides help for Windows NT error messages.
Such as: net helpmsg 4100 // The DHCP client has obtained an IP address that is already in use on the network
. The local interface will be disabled until the DHCP client can obtain a new address.
18. cacls command for setting directory permissions:
Cacls BDPTmpWrkFldr/t/e/c/g "nt authority" SYSTEM ": r
Cacls BDPTmpWrkFldr/t/e/c/g "nt authority" SYSTEM ": f
Remove the permissions of administrators: cacls test/e/r BUILTIN "administrators
Add permission: cacls test/g BUILTIN "administrators: f
No interaction method: echo y | cacls test/e/r BUILTIN "administrators
Echo y | cacls test/g BUILTIN "administrators: f
Echo y | cacls test/g BUILTIN "administrators: f
Cacls test/e/g BUILTIN "users: r
If you do not add/e, the previous settings will be deleted. If you add/e, the append settings will be deleted.
Command to delete a directory
Cmd/c echo y | rd D: "testdir/s
19. netstat-n // you immediately know that you have established a connection with these ip addresses (ports). (Do you know that someone has hacked you)