Learning windows command line

How to check if Windows 32 or 64 bit?

There are multiple ways to check whether a Windows computer is running 32-bit OS or of 64-bit one. Check 32 or 64 bit using WMIC You can get to know the OS architecture by running the below simple command. wmic os get OSArchitecture Example: c:\>wmic os get OSArchitecture OSArchitecture 64-bit c:\> Using program files folder: [. ]

Get Windows install date

If you ever need to find when was Windows installed on your computer or laptop, then here is a Windows command Systeminfo that can help you with that. Run the below Open command prompt Run the command systeminfo | findstr /C:»Install Date» The below example shows install date on my computer C:\>systeminfo | findstr /C:»Install [. ]

User questions about fixing javac not recognized error

Of all my posts, the one that gets most number of comments is – “Javac is not recognized as internal or external command” Due to heavy incoming comments, I stopped approving them long back to avoid the page become a giant one. However there are still users who’ve been commenting that they were not able [. ]

How to Kill process from PowerShell

Powershell provides command Stop-Process to kill a process from command prompt. This command can take in process Id, process name etc and can kill process from CMD. Powershell command to Kill a process using name Below is an example command to kill a process using name of the application or image file. Stop-Process -Name ApplicationName [. ]

Fix WMIC invalid alias verb error

If you use WMIC commands extensively, you would have come across the error – ‘Invalid alias verb’. WMIC error messages are not much self explanatory, so they don’t help in debugging what’s wrong with the command you ran. I encountered this error quite a few times, and upon careful examination I was able to identify [. ]

How to remove user login password from command prompt

For Windows home users, having a login password is not absolutely necessary if the physical access to the device is restricted. Also, anyone running automated tests with login, you may want to enable login automatically without being prompted for a password. Learn how to remove user password for a local user from windows command prompt. [. ]

Run command for performance monitor

Run the following steps to open performance monitor application on Windows computer. Press Windows+R to open run windowType ‘Perfmon’ and press enter. This open the performance monitor application. Performance monitor on Windows 10

PowerShell – Failed to update help for the modules

Powershell help manuals can be updated by running the command ‘Update-Help’ from Powershell command prompt. If you run this command from a normal cmd session, you would get an error as below. PS C:\> update-help update-help : Failed to update Help for the module(s) : ‘AppBackgroundTask, AppLocker, AppvClient, Appx, AssignedAccess, BitLocker, BitsTransfer, BranchCache, CimCmdlets, ConfigCI, [. ]

Run command for remote desktop (RDP client)

The Run command for Windows Remote desktop application is Mstsc Just open Run from start menu and type mstsc in the text box next to open and press enter. This command mstsc can be used from command line too. A system running Windows 7/Windows 10 allows only one remote desktop connection at a time, means [. ]

Find saved outlook emails

It’s a common practice to export Outlook emails as files on disk, this helps save your important emails from accidental deletion or purging out/archiving due to IT enforced policies. It may so happen that now you don’t remember which folder you saved the emails to. This post helps you find them. Here is how you [. ]

Windows commands

All supported versions of Windows (server and client) have a set of Win32 console commands built in.

This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.

Prerequisites

The information that is contained in this topic applies to:

  • Windows Server 2019
  • Windows Server (Semi-Annual Channel)
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2012
  • Windows Server 2008 R2
  • Windows Server 2008
  • Windows 10
  • Windows 8.1

Command shell overview

The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. With Windows Script Host you could run more sophisticated scripts in the Command shell. For more information, see cscript or wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all Commands that are available at the command line.

Windows has two command shells: The Command shell and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.

PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. You can run Windows Commands and PowerShell cmdlets in Powershell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.

Читайте также:  Mercury mw150um драйвер windows 10

For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.

You can also download and install PowerShell Core, the open source version of PowerShell.

Incorrectly editing the registry may severely damage your system. Before making the following changes to the registry, you should back up any valued data on the computer.

To enable or disable file and directory name completion in the Command shell on a computer or user logon session, run regedit.exe and set the following reg_DWOrd value:

To set the reg_DWOrd value, use the hexadecimal value of a control character for a particular function (for example, 0 9 is Tab and 0 08 is Backspace). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

Command-line reference A-Z

To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.

Learn Windows & Linux Command Line

Created by Fettah Ben, Last Updated 22-Jun-2020, Language:English

Learn Windows & Linux Command Line

Find out how to use the command line the way it was meant to be used!

Created by Fettah Ben, Last Updated 22-Jun-2020 , Language: English

What Will I Get ?

  • How to use the command line in both Windows and Linux
  • How to navigate the file systems and directories
  • How to create, edit, and manipulate directories and files
  • How to run the commands using the right syntax
  • An A-Z Index of the Windows & Linux Command Line

Requirements

  • Basic computer proficiency (Everything else is covered in the course)
  • You can take this course even if you have never worked with Linux before.

Description

It doesn’t matter if you’re working with Windows or Linux operating system: taking a good command line tutorial is something every programmer and system administrator should do. Using the terminal gives you greater control and more options, thus making you more flexible and able to deal with a broader set of tasks on hand. In addition to that, it’s faster, uses less RAM than other interfaces, and doesn’t care about the quality of your monitor one bit.

Fettah Ben has been working as a system administrator for over a decade. He knows perfectly well how to use command line the right way – in this 4-hour command line crash course, he will share his knowledge with you too!

Learn command prompts from scratch!

It’s true: we’re living in a world of graphical user interfaces, drag-and-drops, and a multitude of other tools that simplify using technologies to the maximum. However, most programmers will agree you need to understand how to use the command line, which was created back when the only way to call a specific command was by typing.

In this command line tutorial, you will learn all about the command line interface (CLI) and its elements: command line, shell, and terminal window. Fettah Ben will introduce you to the basics file and system navigation and administration in both Linux and Windows:

You will get to know the terminal and understand the benefits of using it in your daily work

You will find out all there is to know about shell scripts and the ways to write them yourself

Last but not least, you will learn command prompts by reviewing syntax patterns. There’s no use in knowing the commands if you’re not writing them properly, right?

Completing this command line tutorial will provide you with enough knowledge to start working on your own server administration projects on Windows or Linux terminals.

A command line crash course – learn in half a day!

Having worked professionally with the command line interface for the last decade, Fettah Ben knows perfectly well what you need to know to begin working on your own projects. In this 4-hour command line tutorial, you will find 47 lessons, conveniently grouped into six distinct sections:

Introduction to the terminology and subject

Picking the terminal: different options you can choose from

Working with files and directories

Your first steps: using cat and echo programs

Tips and tricks to simplify your daily work

Scripting for all your database and OS needs

You might notice some of the lectures are free to review. They offer introductions to the command line tutorial so you know what you can expect from the course. It is also a chance to check whether the instructor’s accent is clear and understandable to you, so make sure to watch them before enrolling in the course.

Learning to work with the command line interface doesn’t take a lot of time, but it can save a lot. Enroll in the comprehensive course introduced by Fettah Ben and master it yourself!

Introduction and What’s Shell, Terminal, CMD

How to use the Windows command line (DOS)

This page covers the basics of navigating and using the Microsoft Windows command line. On this page, you learn how to move around in the command line, find files, manipulate files, and other important commands. Keep in mind that there are over 100 different commands used in MS-DOS and the Windows command line. If you are interested in learning about the command line in more detail, see our DOS and command prompt overview, which gives a description and example for every command.

Get into the Windows command line

Open a Windows command line window by following the steps below. If you need additional information or alternative methods for all versions of Windows, see: How to get to an MS-DOS prompt or Windows command line.

  1. Click Start.
  2. In the Search or Run line, type cmd (short for command), and press Enter .
Читайте также:  При загрузке windows не найден файл

Understanding the prompt

After following the steps above, the Windows command line should be shown (similar to the example below). Windows often starts you at your user directory. In the example below, the user is Mrhope. So, C:\Users\Mrhope> is our prompt. This prompt shows that we’re in the C: drive (default hard drive letter) and currently in the Mrhope directory, a subdirectory of the Users directory.

Key tips

  • MS-DOS and the Windows command line are notcase sensitive.
  • The files and directories shown in Windows are also found in the command line.
  • When working with a file or directory with a space, surround it in quotes. For example, the directory My Documents would be «My Documents» when typed.
  • File names can have a long file name of 255 characters and a three character file extension.
  • When a file or directory is deleted in the command line, it is not moved into the Recycle Bin.
  • If you need help with any of command, type /? after the command. For example, dir /? would give the options available for the dir command.

Listing the files

Let’s learn your first command. Type dir at the prompt to list files in the current directory. You should get an output similar to the example image below. Without using any dir options, this is how dir output appears. As shown, you are given lots of useful information including the creation date and time, directories ( ), and the name of the directory or file. In the example below, there are 0 files listed and 14 directories, indicated by the status message at the bottom of the output.

Every command in the command line has options, which are additional switches and commands that can be added after the command. For example, with the dir command, you can type dir /p to list the files and directories in the current directory one page at a time. This switch is useful to see all the files and directories in a directory with dozens or hundreds of files. Each of the command options and switches is listed in our DOS command overview. We offer guides for individual commands, as well. For example, if you want to see all the options for the dir command, refer to our dir command overview for a complete option listing.

The dir command can also be used to search for specific files and directories using wildcards. For example, to list files or directories that begin with the letter «A» you could type dir a* to list only the AppData directory, in this above example. See the wildcard definition for other examples and help with using wildcards.

Moving into a directory

Now that we’ve seen a list of directories (shown below) in the current directory, move into one of those directories. To move into a directory, we use the cd command, so to move into the Desktop type cd desktop and press Enter . Once you’ve moved into a new directory, the prompt changes. So, in our example, the prompt is now C:\Users\Mrhope\Desktop>. You can see what files are found in this directory by typing the dir command again.

Understand the files

In the Desktop directory, as shown in the above example, there are 23 files and 7 directories, representing different file types. In Windows, you are familiar with files having icons that help represent the file type. In the command line, the same thing is accomplished by the file extensions. For example, «forum posts.txt» is a text file because it has a .txt file extension. Time.mp3 is an MP3 music file and minecraft.exe is an executable file.

Most users are only concerned with executable files, which as mentioned above, are files ending with .exe, .com, and .bat. When the file name is typed in the command line, the program runs, which is the same as double-clicking a file in Windows. For example, if we wanted to run minecraft.exe, typing minecraft at the prompt runs that program.

Keep in mind that if the executable file you are trying to run is not in the current directory, you get an error. Unless you have set a path for the directory with the executable file, which is how the command line finds external commands.

If you want to view the contents of a file, most versions of the command line use the edit command. For example, if we wanted to look at the log file hijackthis.log, we would type edit hijackthis.log at the prompt. For 64-bit versions of Windows that do not support this command, you can use the start command (e.g., type start notepad hijackthis.log) to open the file in Notepad. Additional information about opening and editing a file from the command line is available on the page linked below.

Moving back a directory

You learned earlier the cd command can move into a directory. This command also allows you to go back a directory by typing cd.. at the prompt. When this command is typed, you’ll be moved out of the Desktop directory and back into the user directory. To move back to the root directory type cd\ to get to the C:\> prompt. If you know the name of the directory you want to move into, you can also type cd\ and the directory name. For example, to move into C:\Windows>, type cd\windows at the prompt.

Creating a directory

Now with your basic understanding of navigating the command line, let’s start creating new directories. To create a directory in the current directory, use the mkdir command. For example, create a directory called «test» by typing mkdir test at the prompt. If created successfully, you are returned to the prompt with no error message. After the directory is created, move into that directory with the cd command.

Switching drives

In some circumstances, you may want to copy or list files on another drive. To switch drives in the Windows command line, type the drive letter of the drive followed by a colon. For example, if your CD-ROM drive is the D drive, you would type d: and press Enter . If the drive exists, the prompt changes to that drive letter. If the drive does not exist or is not accessible (e.g., no disc in CD-ROM drive), you get an error.

Читайте также:  Чем открывать rar файл mac os

Creating a new file

You can create a new file from the command line using the edit command, copy con command, or using the start command to open a file.

Creating a new batch file

In the new test directory, let’s create your first file. In most circumstances, you never need to create any file at the command line, but it is still good to understand how files are created. In this example, we are creating a batch file. A batch file is a file that ends with .bat and helps automate frequently used commands in the command line. We are calling this batch file example, so type edit example.bat at the prompt. As mentioned in the document on creating a file, if the edit command does not work, use the start command to open the batch file in Notepad. To perform this action, you type start notepad example.bat into the prompt.

Both of the commands above open a new blank example.bat window. In the file, type the three lines below, which clear the screen with the cls command and run the dir command.

After these three lines are typed into the file, save, and exit the file. If you are in the edit command, click File (or press Alt + F ) and then Save. After the file is saved and you are back at the command prompt, typing dir displays the «example.bat» file in the test directory.

Now, run the batch file to get a better understanding of what a batch file does. To run the batch file, type example at the prompt, which executes the batch file, clears the screen, and runs the dir command.

Moving and copying a file

Now that we’ve created a file, let’s move it into an alternate directory. To help make things easier, create another directory for the files. So, type mkdir dir2 to create a new directory in the test directory called dir2. After the new directory is created, use the move command to move the example.bat file into that directory. To do this, type move example.bat dir2 at the prompt. If done successfully, you get a message indicating the file was moved. You could also substitute the move command for the copy command to copy the file instead of moving it.

Rename a file

After the file is moved into the dir2 directory, move into that directory with the cd command to rename the file. In the dir2 directory, use the rename command to rename the example file into an alternate name. Type rename example.bat first.bat at the prompt to rename the file to «first.bat.» Now, when using the dir command, you see «first.bat» as the only file.

When renaming any file, make sure the file has the same file extension. If you were to rename the .bat file to a .txt file, it is no longer an executable file only a text file. Also, keep in mind that renaming the file to a different file extension does not convert the file. For example, if you renamed the file as an .MP3, it may look like an MP3 in Windows, but it’s not going to play music.

Deleting a file

Now that we’ve had our fun with our new file, delete the file with the del command. Type del first.bat to delete the first.bat file. If successful, you are returned to the prompt with no errors, and the dir command shows no files in the current directory.

When deleting files, you can also use wildcards to delete multiple files at once. For example, if the directory contained several .GIF image files you could type del *.gif to delete all files ending with the .gif file extension.

Renaming a directory

Go back one directory to get back to the test directory using the cd.. command mentioned earlier. Now, rename our dir2 directory to something else using the same rename command we used earlier. At the prompt, type rename dir2 hope to rename the directory to «hope.» After this command is completed, type dir and you see one directory called «hope.»

Removing a directory

While still in the test directory, remove the hope directory using the rmdir command. At the prompt, type rmdir hope to remove the hope directory.

If the directory you are trying to remove contains any files or directories, you’ll receive an error. To prevent this error, use the /s option. For example, if the hope directory still had the first.bat file, you would need to type rmdir /s hope at the prompt.

Running a program

Any executable file can run from the command line by typing the name of the file. For example, if you listed files using the dir command and see a file named «myfile.exe,» typing «myfile» at the command line runs that program.

How to list available commands

After getting a good understanding of using the command line from the steps shown above, you can move on to other available commands by typing help at the command line. Typing «help» displays a list of available commands with a brief description of each command.

Closing or exiting the command line window

After you are done with the Windows command line, you can type exit to close the window.

In conclusion

Now you have a good understanding of how to navigate the command line, create directories and files, rename directories and files, and delete. As mentioned earlier, there are hundreds of other commands you can use at the command line. If you want to expand your knowledge further, we recommend looking at the options available for each command above and reviewing our commands overview page. You can also use our search to find any command by the name of the command or by the action it performs.

Оцените статью