Ken's Korner Newsletter Logo June 2023
More Windows Tips

How to use the Command Prompt.
This edition of the newsletter will focus on using the command prompt. That lowly little window that dates to some of the earliest days of computers when you had to type the commands in manually.

The command prompt is still useful for a great many operations. In some cases, it is the easiest way to perform a task. To open a command prompt from the desktop type cmd in the search box. Select the Command Prompt entry and click Open.

Avoiding the trap. Some tasks require the use of an elevated command prompt. To open an elevated command prompt, follow the same steps to open a command prompt but click Run as administrator instead of just Open. I have reached the point where I use the elevated command prompt most of the time.

You can also open a command prompt from within any folder. Just navigate to the folder you want like you usually do. Then type cmd in the address bar at the top of the window and press Enter. One tip before we start, to clear the window type cls and press enter. All text will be removed leaving only the command prompt.

If you right click the top bar in the command prompt window and click on settings from the drop down menu you can change a number of features including the color scheme. Personally, I prefer the light background with dark text, but you can choose your own favorite combination. People with partial color blindness tend to pick some rather bizarre combination because it is easier for them to see the layout.

Here is a list of some of the things you can do from the command prompt. There are many more. The last two items on this list are just for fun. You may think this seems a little archaic. You would be right but sometimes it is still the best and sometimes the only way to get something done. Remember, there was a time, before the GUI, when this was the only way we could work on computers.

IP address
Find the current local IP address of your computer. Open a command prompt and type ipconfig and press enter. It will show the IPv6 address, the IPv4 address, The Subnet Mask and the Default Gateway for the current network adapter. It will also show the state of the other adapters, both physical and virtual.

You can release and renew the DHCP address for the adapter. Type ipconfig /release and press enter. Using the /release switch will release the DHCP address. You will be disconnected from the network. Type ipconfig /renew and press enter to renew the DHCP address for all the adapters and reconnect to the network.

For more information about the network connection for your computer you can type ipconfig /all and press enter. This will provide greater details about the network adapter and the network it is attached to. For a full list of all the available switches for the command type ipconfig /? and press enter.

Logged in users
To see which users are logged in open a command prompt then type whoami /all and press enter. By scrolling through the list, you can see groups and privileges as well as users.

Active and connected devices
this is a handy tool for network administrators. Check which devices are active and connected, open a command prompt and type netstat and press enter. For more information you can type netstat -a and press enter. If you see a connection that doesn’t belong here it may be time to take action. Type netstat -? for a list of switches that work with netstat.

See where your data is going
You can follow the path the data packets take on their way to the destination by using the tracert command. In the old days this was just trace but Microsoft add the “rt” to the end of it for some reason. Open a command prompt, type tracert the_name_or_ipaddress you want to trace to and press enter. Type tracert -? For a list of variables that you can use with this command.

Fast moving information

Take ownership
You get a new computer and copy the files from your old hard drive. When you try to access the files from your old computer you may find that they are not accessible because you are no longer the owner of those files.

To take ownership of the file open a command prompt in the folder with the file you want to reclaim and type takeown /f filename.extension and press enter. Type the file name and extension exactly as it appears, otherwise it will not be found. You now have full access to that file.

You can also take ownership of the entire folder. Navigate to the folder you want to reclaim. Copy the location from the address bar at the top and open a command prompt in that folder. Type takeown /f folderlocation /r into the command window. You can paste and replace folderloaction with the appropriate address that you copied from the address bar. You now have full access to all the files in that folder.

If you type takeown /? In the command prompt window, you will get a list of all the options for this command including some examples.

Remove a program that won’t uninstall
Sometime a program just won’t uninstall. It could be a “bug” in the uninstaller but for whatever reason the program is stuck on the computer. Using the command prompt instead of downloading a third-party uninstaller could save the day.

This process uses a built-in tool from Microsoft known as Windows Management Instrumentation. There is a command line interface to the WMI so that it can be run from the command prompt. This will require the use of an elevated command prompt. In other words, you must open the command prompt with the Run as administrator option.

  1. In the elevated command prompt type wmic and press enter. (The prompt will change to something like wmic:root\cli>.)
  2. Input, (that means type) the command product get name and press enter. (This will generate a list of installed programs.)
  3. Type product where name=”program name” call uninstall and press enter. (Replace program name with the name of the program from this list generated in the previous step. You must type it exactly as it appears in the list.)
  4. Type Y and press enter to confirm the operation and remove the selected program.
  5. If the process was successful, you will see a ReturnValue = 0 at the end.

Type quit to end the WIMC session and return to the elevated command prompt.

This is just one of the many things you can do with WMIC. For example, type wmic bios get serialnumber and it will return the serial number of the computer. If you type wmic /? you can see a list of the various switches, verbs, aliases and associations used in WMI. You may also notice that Microsoft has classified WMI as Depreciated. That usually means they plan to discontinue it. I hope they decide to keep it. It has proved invaluable to me many times over the years.

View a text file
You can read a text file in the command prompt. It doesn’t launch a program; it just opens the text file and allows you to read it.

  1. Open a command prompt window in the folder with the text file.
  2. You can type dir *.txt and press enter to list all the text files in the folder.
  3. Use the type “filename.extension” command and press enter. You must type the file name and extension exactly as it appears, or it will not be able to find the file. If there are blank spaces within the file name, you will have to enclose the file name in quotes.
  4. The text document opens in the command window.

Check installed drivers
You can check for all the currently installed drivers. Since drivers tell your hardware how to communicate with Windows, they must always be readable, reliable and uncorrupted.

To see what your driver situation looks like open an elevated command prompt. Type driverquery and press enter. Scroll though the list to get details about every driver currently installed. Link date shows the last time the driver was updated if such information is available.

When troubleshooting network connectivity issues NSlookup can be a valuable tool. Computers and other network devices communicate by IP addresses. It would be difficult, in the extreme, for humans to remember all the IP addresses for even rather simple examples of communication. We just type in a name like The computer then goes to a Domain Name Server, (DNS) and gets the address for that name. DNS errors can render a network useless since the network devices cannot talk to each other.

Open a command prompt then type nslookup and press enter. It will return the IP address of Since we can be pretty sure that Google is up, running and operational if nslookup cannot find it there is something wrong between your computer and the Google servers.

The nslookup tool also works in reverse. If you know the IP address, you can get the domain name. Type nslookup and press enter. It should return the name

You can find the mail server that handles the email for a domain with nslookup. Type nslookup -type=mx and press enter. As you might expect, Google has more than one mail server.

Your local DNS server, which is usually provided by your ISP may not have the IP address for the domain name you have requested. In that case, the local DNS server looks upstream to find a DNS server that doe have the information. The DNS Server that is the best source of information for a given domain is known as the Start of Authority, (SOA). To find the SOA DNS server for your domain type nslookup -type=soa and press enter. You can type nslookup /? and press enter for more information about the nslookup command.

Robot thinker

View and Close Running programs and Tasks
With Windows built in Task Manager you can deal with running programs but that may not always work. The Task Manager monitors things in real time. You can use tasklist to create a static list that doesn’t constantly keep updating. That way you can scroll through it in a more orderly manner and locate the stubborn program.

  1. Open an elevated command prompt.
  2. Type tasklist and press enter. It will list all the tasks and processes running at the time the command was executed.
  3. Locate the program you want to shutdown and take note of the Image Name field. You will need that for the next step.
  4. Type taskkill /im “imagename.exe” and press enter.
  5. Alternatively, you can use taskkill /pid pidnumber and the PID number for the task instead of the image name.
  6. The termination request is sent, and the process or task closes immediately.

The taskkill command can shut down multiple tasks or processes with one command. For more ways to use taskkill type taskkill /? And press enter.

You can shut down the computer without using a mouse or keyboard. Why would you want to do this. If you are working from a batch file or on a remote computer, it may be useful.

Open a command prompt and type shutdown /s. The computer will shut down right away. You can type shutdown /r and the computer will shutdown and restart. There are a number of other arguments that you can use to modify the actions of the shutdown command. Type shutdown /? For the full list.

Just for fun
Here are two uses for the command prompt that are just for fun. They will require the use of another old program called Telnet. Telnet is still in Windows 11, but it is turned off by default. To turn Tenet on, go to Control Panel and click on Programs and Features. In the left panel click on Turn Windows features on or off. Scroll down to Telnet Client and check the checkbox and click OK.

Star Wars
You can watch Star Wars in the command prompt. Maybe not the Star Wars you are thinking about. Open a command window and type telnet and press enter.

  1. Type telnet and press enter.
  2. Then type starwars and press enter.

Sit back and enjoy. It works but I don’t think I am going to cancel my Netflix service for this.

You may have noticed that there other choices from Another possibility from the same source is the aquarium program.

  1. Type telnet and press enter.
  2. Then type aquarium and press enter.

Type quit to exit the telnet program and return to the command prompt. You may want to go back and turn off telnet when you have had your fill of Star Wars and the aquarium. Very few things still use telnet which is why it was not turned on by default.

If you want to “get under the hood” of Windows and see what is going on the old command prompt still has many uses. That is why so many “Geeks” still use it.

If you know someone that you think would enjoy this newsletter, share it with them and ask them to join using the link at the bottom of the page.


And remember — always back it up!



Go back to the top

To get the Ken's Korner Newsletter delivered to your Inbox CLICK HERE