How to remove system file attribute
We can clear system file attribute of a file using the command attrib. Syntax is given below.
Example:
The above command will remove system file attribute for the file systemfile.exe
Windows XP, Vista and Windows 7 Command Line Tips
We can clear system file attribute of a file using the command attrib. Syntax is given below.
Firewall configuration can be done from command line using netsh command. To enable firewall run the following command.
netsh firewall set opmode mode=ENABLE
Administrator previliges are required to configure firewall so above command can be run only from admin accounts.
We can clear read-only attribute of a file from command line using attrib command.
We can use compress.exe utility to compress a file from command line. See syntax below.
To coompress a file file1.txt:
compress file1.txt compressedfile1.txt
This tool is available for public download as part of windows server 2003 resource kit. It can be downloaded from the below location.
http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en
We can add a new users group from command line too. We can use net localgroup command for this.
For example to add new group with the name say XPUSERS we can run the below command.
net localgroup XPUSERS /add
We can reboot a machine by using shutdown command from command line.
To reboot the computer:
shutdown -r
To shutdown the computer:
shutdown -s
To abort shutdown:
shutdown -a
We can remove users from a group using command line too. We can use net localgroup command for this.
For example to remove user John from administrators group we can run the below command.
net localgroup administrators John /delete
To list the user names having account on the local system you can run the following command.
net user
We can use the command title to change the namee that appears on the blue bar at the top of command window
c:\>title new_window
The above command will change the title to new_window
Example:
command window initially:
We can use below command to see the list of shares mapped as network drives.
c:\> net use
We can map a network share to local drive from command line too. Command is given below.
net use z: \\servername\sharename
The above command maps the drive letter Z: to the network share \\servername\sharename. If the logged in user has credentials to access this network share, the above command completes successfully without asking for any forther information. Otherwise it asks for the user name and password with which the share can be accessed. Upon providing this information, the share will be mapped to the drive Z:
We can also use * instead of Z:. This will automatically pick up the unused drive letter starting from Z:
You can use the command cls to clear screen in command prompt.
We can open Add or Remove Programs wizard from command line using appwiz.cpl command.
c:> appwiz.cpl
Or do the following to open the wizard from Run window.
Run Ncpa.cpl to open network connections from command line. You can also execute ncpa.cpl from Run window to open network connections.
c:> ncpa.cpl
or
We can see the list of all user accounts created on a computer system using net command.
Just run "net user" from command line and it will print the login names of all the users on the system.
Use the command calc to launch calculator uitility from command line.
We can turn off a computer from command line using shutdown command. See the syntax for this below.
Shutdown -s
The above command opens a small window which displays a 30 seconds counter to start shut down of the computer. If we want to abort the shutdown we can run the command shutdown -a from command prompt.
We can launch disk cleanup tool from command line using cleanmgr command. Just run cleanmgr from command prompt.
We can lauch windows update from command line using wupdmgr.exe utility. Just run Wupdmgr from command line and IE window will opena nd will connect to microsoft update portal automatically.
Use the command 'Write' to open Wordpad application from command line. Normally one would assume that the command would be wordpad if it can be launched from command line. But in this case it is Write. No idea why is it so.
We can create files from command line in two ways. One is using fsutil command and the other way is to use echo command. if you want to write any specific data in the file then use echo command using which you can write the data directly to the file from command line. If you are not bothered about the data in the file but just want to create a file of some specific size then you can use fsutil command.
To create file using echo
echo text-to-be-written-into-the-file > filename.txt
example:
On Windows operating system text files usually have .txt extenstion(Yes we can create text files even without .txt extension but unless you have any other special purpose there is no point in doing that). So we can easily find out all the text files in any directory/drive by using dir command.
dir /S *.txt
( /S indicates that search needs to be performed in subfolders too.)
Windows firewall can be turned off using the below command.
netsh firewall set opmode mode=DISABLE
An alternative way using user interface is to open firewall.cpl from Run command and then configuring the options in it.
In Renaming files from command line we saw how to rename files using Rename command. We can use Rename command to rename directories too. See the syntax below.
Rename dir_oldname dir_newname
Example:
We can delete a directory from command line using rmdir command. See syntax below
rmdir directoryname
Examples:
When you open command window what you would see is like below.
We can read a text file from command line using type command.
Example: Let us se the contents of the file c:\boot.ini
Del command can be used to delete file(s) from command line. This can be used only to delete files and not for deleting directories. But we can use this do delete all the files in a given directory.
Examples:
To delete a file d:\dir1\data.doc:
We can use the built-in command line utility rename to rename a file. Note that this command is just to rename a file keeping it in the same location and can't be used to rename it as a file in a different folder.
Ex: