Windows: Install Telnet Client – CMD & PowerShell

The telnet client in Windows is disabled by default.

Before using the telnet command in Windows it is needed to enable the telnet client, otherwise you’ll get a result similar to the below messages:

CMD: ‘telnet’ is not recognized as an internal or external command, operable program or batch file.

PowerShell: The term ‘telnet’ is not recognized as the name of a cmdlet, function, script file, or operable program.

In this note i am showing how to install the telnet client via the Windows CMD & PowerShell and how to use the telnet command to watch the Star Wars movie on the command prompt. (more…)

[SOLVED] CMD does not support UNC paths as current directories

If you try to cd to a network drive from the Windows CMD, you will get the following error:

CMD does not support UNC paths as current directories

Instead of cd command in CMD you can use a pushd command, that creates a drive mapping to the network share and then changes into a path relative to the share it creates.

In PowerShell you should be able to cd to a network drive without any errors as it natively supports UNC paths and the cd command.

In this small note i am showing how to cd to a network drive from the Windows CMD and fix the error: “CMD does not support UNC paths as current directories“. (more…)

PowerShell: Clear History of Previous Commands

This is not obvious, but the Clear-History command in PowerShell won’t clear the history of the previous commands.

The Clear-History clears only the commands entered during the current session, that could be displayed by the Get-History command.

To clear the history in PowerShell, it needs to delete the file in which the previous commands are stored.

In this note i am showing how to locate the history file and how to clear the history of the PowerShell commands. (more…)

Windows: PowerShell – Download File From URL

Windows PowerShell can be used for downloading files via HTTP and HTTPS protocols.

In PowerShell, as an alternative to the Linux curl and wget commands, there is an Invoke-WebRequest command, that can be used for downloading files from URLs.

In this note i am showing how to download a file from URL using the Invoke-WebRequest command in PowerShell, how to fix slow download speed and how to pass HTTP headers (e.g. API key) (more…)

Windows: Start Service – CMD & PowerShell

The services in Windows can be started using the Service Manager tool.

To start the Service Manager GUI, press ⊞ Win keybutton to open the start menu, type in services to search for the Service Manager and press Enter to launch it.

The services can also be started using the command-line prompt (CMD) or the PowerShell.

In this note i am showing how to start, stop or check the status of a service in Windows using the command-line prompt (CMD) or the PowerShell. (more…)

Windows: List Services – CMD & PowerShell

The services in Windows can be listed using the Service Manager tool.

To start the Service Manager GUI, press ⊞ Win keybutton to open the “Start” menu, type in services to search for the Service Manager and press Enter to launch it.

The services can also be listed using the command-line prompt (CMD) or the PowerShell.

In this note i am showing how to list the services and how to search for a specific service in Windows using the command-line prompt (CMD) or the PowerShell. (more…)

Windows: Get Exit Code (ErrorLevel) – CMD & PowerShell

Every command or application returns an exit status, also known as a return status or exit code.

A successful command or application returns a 0, while an unsuccessful one returns a non-zero value that usually can be interpreted as an error code.

In Linux you can get the exit status of a last command by executing echo $?.

In this article i will show how to get the return code from the last console command or application in Windows using the command-line prompt (CMD) or the PowerShell. (more…)

Windows: Set Environment Variable – CMD & PowerShell

What is an environment variable in Windows? An environment variable is a dynamic “object” containing an editable value which may be used by one or more software programs in Windows.

In this note i am showing how to set an environment variable in Windows from the command-line prompt (CMD) and from the Windows PowerShell.

In the examples below i will set an environment variable temporary (for the current terminal session only), permanently for the current user and globally for the whole system. (more…)

Windows: `Grep` Equivalent – CMD & PowerShell

The grep command in Linux is widely used for parsing files and searching for useful data in the outputs of different commands.

The findstr command is a Windows grep equivalent in a Windows command-line prompt (CMD).

In a Windows PowerShell the alternative for grep is the Select-String command.

Below you will find some examples of how to “grep” in Windows using these alternatives. (more…)