346
133 shares, 346 points

Did you know that you can do file and some process operations much more effectively by using command prompt on Windows systems? In this article, we explain how you can do some basic tasks faster by using the power of the command line.

On Windows systems

When you run the command prompt, you will start working under your user folder if you have normal user privileges, and under C:WindowsSystem32 if you have Administrator rights. When you switch to other directories, you may want to know where you are and what path you have come to. We use the cd or chdir command for this. cd, ” Current Directory” so “current directory”, if chdir “change directory” which means “change dir”

Abbreviation of .

At this point, you may have some questions in your mind because the cd and chdir commands are normally used to switch to other directories as you know, but on Windows systems you can use these commands to learn the directory you are in. Don’t worry, we’ll also cover how to switch between directories.

As you can see in the screenshot below, both the cd command and the chdir command show that we are currently in the AkilGUNDOGAN user’s directory. this use of cd Unix-like its equivalent in systems is pwd.

You probably need to switch to other directories and work while using the command prompt. For this, you can use the same way as cd to be passed DirectoryPath or chdir to be passed DirectoryPath. For example, in the screenshot below, to show the functionality of both commands, I would first switch to the Desktop directory using cd, and then name the directory named CommandLineBookPicture using chdir. Each time, I checked which directory I was in by entering the cd and chdir commands without writing any directory names next to them.

Sometimes we come to one parent directory we may need to go back. For this, constantly entering the full path of the parent directory can be quite tiring. For example, it is very difficult to write cd C:UsersAkilGUNDOGAN every time to switch from the Desktop directory to the AkilGUNDOGAN directory, which is above it. For this, there is another feature of the cd command that we need to know. When working in a directory, cd . . If you type it, you will switch to a higher directory.

In the screenshot below cd . . By entering the command CommandLineBookPicture directory to Desktop, which is a parent directory, and then cd again. . I changed to my original user directory by typing

Let’s say you are not a directory, but 3-4 parent directories. cd for this. . In addition to our command, bring a / sign and repeat . . When we write it, we will have named two directories at once. For example cd. . / . . When you enter a command in the form, you switch two directories up.

Since I want to name 3 directories, cd below. . /. . /. . I entered a command in the form of a command and as you can see, I have named the Users folder from the CommandLineGuidePicture folder, which is a subdirectory of Desktop under the AkilGUNDOGAN user. I checked the directory I was in by typing cd again.

Windows

like NT kernel using a specific command prompt. inside folder or when we need to list the files in the directory we are working in, we use the dir command, which is the abbreviation of the word “directory”, which means “directory” in American. The equivalent of this command in Unix-Like systems is ls. The output we get gives us information such as the last edit date of the files, whether they are a file or directory, and the total size.

If we want to create a directory with the help of the command prompt, there are two commands that we can use for the same job. The first and most well-known of these komudollarsars is mk. As the name suggests, “make is” so “create directory”

Short for . Another command is md. “mkdir”

You can also use md, which is a shortened version of to create folders. In the screenshot below, we created folders by using both commands and when we listed the contents of the folder with the dir command, we saw that the directories were created.

If we want to display the contents of any text document, we use the type command with the file name on Windows systems. You can print the contents of the text document at the command prompt by using type filename. The downside of this command is that if in a text document American characters , the relevant characters are reflected in the command line as corrupted. For this reason, it would be more appropriate to use the type command to display text documents with a wide variety of codes.

Linux In many of the systems, basic information about the computer is obtained with the help of the neofetch command, and there is a command that you can use to obtain system information in Windows. With the help of the systeminfo command, you can get an output summary about the operating system, computer, updates and network configuration.

Windows If we want to move a directory with the help of the command line in systems, we can use the move command, which is the English equivalent of the word move. For example, let’s say I want to move the folder named My DocumentDirectory, which is located in the folder named exampledirectory, to the articles folder on the desktop. For this, I can use my move document Directory C:UsersAkilGUNDOGANDesktopCommandLineGuidePicture.

As seen in the screenshot below, I first check the inside of the example directory folder by entering the dir command and keep the name of the directory I want to move in mind. Then, as I just mentioned, I want to move the relevant directory to the desktop, so I enter my command as move document Directory C:UsersAkilGUNDOGANDesktoparticles. As you can see, when I go to our target directory and check the latest status, I see that it has been successfully migrated.

If we want to rename the directory/folder, we can use the move command. on Windows We can say that the commands are quite strange in this respect because in most of the other operating systems a command executes only one main task, while in Windows systems you can do many tasks that have nothing to do with the name of the command. Here, the move command is not only used to move files and directories, but also files and directories. rename can also be used for.

For this, you can use move directoryname as newname of directory. Since you did not specify any path, the directory will be renamed.

Likewise, you can use the move command to rename not only directories but also files.

If you want to delete the directory/folder you created “Remove Dir” so “Delete Directory”

You can use the rmdir command, which is short for . Typically what this command does is the same as right-clicking and deleting. But the thing to remember is that any directory you delete with this command “Recycle Bin” is not being sent to. Think twice before using this command as that folder will be permanently deleted.

If there are some files in the directory you want to delete, when you use the rmdir directory name. directory is not deleted. For this, you need to use the rmdir command with the /S or /Q tags. The /S tag gets confirmation before the files are deleted, while the /Q tag is silently deleted without confirmation.

For example, when we delete a folder named abcdirectory with the rmdir command without using the /S suffix, we will get the error in the screenshot below. If we use the /S tag, the directory will be deleted successfully after giving confirmation.

If you want to create a text document with the help of the command line and write in it, there is no specific command for Windows, but you can do this by using different commands in appropriate ways.

If you remember, we said that we used the echo command to print text to the console. We will also use the echo command to print text to the text document. What we have to do is actually very simple. Where we will create the text document, we keep the relevant file path in mind or we go to the relevant path with the help of the cd command. Then echo text to write > textdocument. By using a txt format, we both create a text document and also print something in it.

Although the echo command is nice, it doesn’t really offer us an editor experience. If we want to create a text document with the command line, we can also use the classic notepad command for this. In the same directory where we will create the document, notepad text document after coming to the relevant directory. txt command is enough to write. After entering the command notebook will meet us and new text document will ask if we want to create it. After you accept, you can write your text in it. Don’t forget to save when closing.

If you don’t want to deal with cumbersome GUI interfaces after all, Windows also offers a mini console editor for that. The only feature of this editor is to write text inside a text document. If you want to create a text document with this method and write text in it, copy con textdocument2. You can use it in the form of txt.

After entering this command, the mini editor will start so that you can write text in the text document. After typing what you want, you can press CTRL+Z to exit.

Two files, especially two files of text document type with each other compare If you want to find the differences then you can use the comp command. The comp command is used for many purposes. You can specify the intended use as comp file1 file2 /argument. For whatever purpose you will use the argument part, its argument/attachment must come. What we have said may sound quite confusing, but you will understand the situation better with what we will say a little later.

For example, I have the slight differences between them below. two text documents first I wanted to display it with type command. The differences are obvious and visible. But imagine that you have two similar text documents with thousands of lines and you need to compare them. That’s why we use the comp command. I text document1. txt and text document2. comp textdocument1 because I want to compare the differences in the txt in terms of letters. txt text document2. I used the txt /A command. /A here, ASCII refers to characters. As you know, the numerical equivalent of each letter and number in computer language ASCII.

As you can see, right after entering the command, it successfully presented us the differences it saw as output. If you’re wondering about the uses of the comp command with different arguments, comp /? You can view the help information for the command by typing

On Windows systems We use the del command to delete a file with the help of command prompt. If the del command is not used consciously, there is no compensation because deleted files To “Recycle Bin” will be permanently deleted before posting. Therefore, you should be careful not to make mistakes when using the del command.

You can use the del command with the /P prefix to prevent accidental deletion. When you use it with this jewelry, it will ask you for confirmation in the form of Y(Yes)/N(No) before the deletion process is performed.

Note: The erase command also sees the exact same function of the del command. You can use any of these two commands for file deletion.

On Windows systems To copy a file to a remote destination, we use the copy or xcopy command. The copy and xcopy commands, yellow, have a very important place in order to organize file structures in Windows systems.

You can use the copy command as copy filename targetdirectory. For example, in the screenshot below, I checked the contents of the sample directory that I will copy first with the help of the dir command. Then I copied the file in the relevant folder to the folder named texts on the desktop with the help of the copy command.

Likewise, you can use the xcopy command to copy files. When it comes to copying files, there is no difference between it and the copy command. You can use xcopy filename as target directory.

You’ve seen that both commands do the same job when it comes to file copying, but then why are they in two separate commands? Actually, the answer to this question is very simple. Copy basically “Command Prompt” so “cmd. exe” is a tool/command that can run under, while xcopy is “xcopy. exe”

It is a standalone software called . Since the copy command doesn’t quite meet the needs, xcopy Microsoft

Developed by .

Now, since both commands are quite old, they are replaced. on modern Windows versions found “Robust File Copy” ie ROBOCOPY command, which means powerful file copy, is expected to take. ROBOCOPY is an advanced command line tool that almost completely covers the shortcomings of copy and xcopy. ROBOCOPY has many more features such as high-speed copying, directory copying, renaming. You can access ROBOCOPY by typing robocopy at the command prompt.

You can use the robocopy command as robocopy exampledirectoryexampledirectory1. This creates a copy of the “exampledirectory” folder named “exampledirectory1”. After using the command, Robocopy also informs you about the latest copying status. Based on this output, you can see whether the files were copied successfully and the speed of the copying process.

Apart from all these, there is another very useful feature that you can use with the copy command. Combining. You can easily combine text or binary code type files. If what we are going to merge is a text document, you can use the /A (representing ASCII characters) tag with the copy command, and the /B tag to combine binary (MP3, archives or PE) files. For example copy /b firstmusic. mp3 + secondmusic. mp3 unitedmusic. When you use the mp3 command, the MP3 file named firstmusic and the secondmusic will be merged and merged. A new audio file named mp3 will be created. When you open the music, you can see the two files merged.

Note: Every file that you merge with the /b command may not work properly, even if the merge process takes place, the file may not be opened. The tested file are formatollaryellow archives and MP3 files.

Usually, when we work hard and there is something that we need to take notes urgently, we either quickly open a text document and write it in, or we write down our notes in the files where many other things are written. When the relevant note is needed later, it may feel like torture to check the lines in the file one by one. However, we can easily handle this using the command line.

On Windows systems with the help of command line extracts a string from text documents if we want to search “find” find means if character array from files

if we are looking for “find character”

We use the findstr command which means .

I wrote the file, as seen in the screenshot below. Write “Akil” using a few words related to what I am looking for from a text document called txt file. I entered a txt command. The find command did its job successfully, showing me what I was looking for. The search word is always in quotation marks, otherwise the command will not work.

Sometimes we need to check if a file contains some character strings. Let’s say I am also Archive. I’m wondering if I have the characters I’m looking for in my zip archive file. For this, it will be enough to enter a command in the form of findstr “Akil” Archive.zip.

If we want to change the system date in a practical way with the help of command prompt on Windows systems, it is a very practical command for this. “date”

We can use date which means .

Note: Komudollarsar under this heading admin privileges it needs. Therefore, you need to start the command prompt as an administrator before applying. Otherwise access denied error you will get.

First, let’s check our current date and time setting by saying date /T. As you see 21. 02. 2021 appears. Then let’s just enter the date command and write what date and time we want to set it. I 22. 05. 2020 I wanted to set it to date. When you check with date /T again, you will see that your system date has changed.

If you gave up after typing the date command, without typing anything ENTER

If you press the key, no changes will be made.

If we want to change the system clock we have to use another command for that. For this “time” so ​​we are using the time command. The time when I took the screenshot 23. 31 To change this, you need to directly enter the time command and write it in hour:minute format. Then, when you use the time command with /T, you can see that the time has changed successfully.

In Windows systems, if we want to list the running processes (process) with the help of command prompt “task list”

We use the tasklist command, which stands for .

When you use the tasklist command without any tags, it will show all running processes.

But let’s say that a certain DLL module we also want to see the transactions used. For this, we can use the /M tag with the tasklist command. /M stands for module. For example tasklist /M kernel32. A use in the form of dll is kernel32. It will show processes using the dll.

The main reason for us to prepare this article was to show that console operations are as easy as those with the graphical interface, or even much easier. Many Windows users use the task manager if they want to force close a running process. As you know, it can be very difficult to reach the task manager, depending on the location. CTRL+ALT+Delete

Pressing the combination, selecting the process to kill from the list and confirming the boxes is a waste of time.

In fact, there is no need for all this. With just a little code, you can kill any process you want to stop within your user account privileges. For this “kill task”

You can use taskkill which stands for .

Normally, you can enter and use many commands directly without using any jewelry, but this is not the case for taskkill. You need to know some special tricks to be able to terminate processes using taskkill effectively. For this, first taskkill /? Let’s learn about the use of the command by typing.

We got our knowledge. The /F and /T jewelry must have caught your eye. /T means to stop the process and its sub-processes, while /F means to force shutdown. “Well, aren’t we forcibly closing it already?” you can say. No, we do not force close. Namely, if you want to stop a process, you have two options. As in Linux systems, you either send a shutdown request and wait for it to close, or you close it forcibly.

If the process you will stop is not very important and the sudden closing of the program does not adversely affect it, you can force it to close. For this, the /F and /T tags must be used at the same time. For example firefox. taskkill /IM firefox to stop the exe process. We can use it as exe /F /T. The /IM tag indicates the module name here.

As you can see, the related processes were forcibly stopped within the user’s authority, Firefox was closed. unstoppable here. one transaction may have caught your eye. It is likely that this security software is used to protect your browser. injected could be one of the parts. this much security software in general with system rights is running, so you can’t stop it even if you wanted to. But firefox. Since Firefox will close after the exe processes are terminated, the injected module will not continue to be under that process.

Many of us are at home, at work, or in other settings. our wireless network password in general after entering once we forget. While everything is going very well, we may need a password from other devices to connect to the same network. You don’t need to get up and try to learn the password again, or even reset your modem or router and set a new password. You can get your wireless network password in plain text using two simple netsh commands.

First of all, you have to type a command like netsh wlan show profiles to run the command prompt and view the registered wireless networks. ENTER

Pressing the key. This command will list for us the currently registered or connected wireless networks. This information is important so that we can retrieve the password later. For various privacy reasons, I’ve covered my own network’s name in the screenshot and replaced it with another name.

It’s time to learn the password of our wireless network. For this, using netsh wlan show profiles “wirelessNetworkName” key=clear will suffice. The phrase key=clear at the end of this command indicates the password. clear plain text.

On Windows systems As you know, each file has its own attribute. If we simply explain what a file attribute is, we can say that it is what gives us information about a file itself. You can get information such as whether the file is archive, hidden or visible, image or text by looking at the file attribute.

The command we use for this is “attribute”

attrib, which stands for . Simply, after coming to the directory where our file is located, you can get information about the attribute of the file by using the attrib filename.

The purpose of the attrib command is not just to display file attributes. Remember that it is a very useful and effective command when you use attrib with its charms. So, what are these jewelry we’re talking about? First of all attrib /? We learn by writing.

As you can see, the syntax structure of the command is attrib /any filepath. Each of these jewelry has a different meaning in itself.

  • + : Add the attribute.
  • – : Clear attribute.
  • R : Attribute of read-only files.
  • A : Attribute of archive files.
  • S : Attribute of system files.
  • H : Attribute of hidden files.
  • O : Offline file attribute.
  • Drive : The drive whose attribute will be edited
  • /S : Jewelry showing the modifications made on the attribute.
  • /D : To show the processed directory.

Let’s say C drive

You have a folder named exampledirectory under and you want to hide this folder. For this, you can use attrib + H as an example index. This will only hide the folder named exampledirectory, keep in mind that the files inside it still do not have the hidden file feature. For this, as seen in the second screenshot, it will be sufficient to first switch to the folder named exampledirectory and then enter the attrib +H “*” command. * is a wildcard character denoting all files.

Found on Windows systems and used by many software scheduled tasks If you want to view it without the need for a graphical interface, you can use the command prompt. All you have to do is enter the schtasks command.

Until this part of our article, we have learned enough to do our work with command prompt, from basic file operations to command prompts. As we mentioned at the beginning of the article, shells are one of the sine qua non of an operating system. Therefore most basic system operations it is possible to get most of them done using komudollarsar.

Here we are using the command create a new user account and, Administrator authority we will give. In this way, you will be able to create or delete new user accounts using two commands. We use net user for this.

Note: To use these commands, you must run command prompt as administrator. Otherwise you will get an error that access is denied.

First of all, I wanted to create a new user account named Akil_IS, so I entered a command like net user Akil_IS bubenimsifrem /add. Here, Akil_IS is your username, and thismypassword is your account password.

Then let’s use the net user command again without any additions. As you can see the account has been successfully created. Let’s secure our job and enter the command that we give administrator privileges. To do this, type net localgroup administrators Akil_IS /add ENTER will be enough to press the button.

If you want to delete the user account you created, that is pretty easy too. net user Akil_IS /delete by entering the command to account for the relevant user. you can delete. To see if the operation was successful, let’s type net user and check the existing user accounts again. As can be seen from the screenshot, our command has been successfully completed.

If you want to stop or start some services running in the background of the system, you can use the net start and net stop commands.

Note: These commandolarsar need administrator privileges.

We can enter our command as net stop servicename to stop the service, and net start servicename to restart the service. For example I am below Wireless network service

I stopped and restarted.

installed on your system device drivers

If you want to view or get the full list, you don’t need to use an external program. You can use the driverquery command for this. On the left you can see the name of the drivers, on the right you can see what they do and what type of driver they are.

As you know, the only shell in Windows systems “Command Prompt” is not. Microsoft new generation PowerShell now offers us a much stronger shell. Since PowerShell is a sea of ​​commands in terms of commands, it is not possible to mention all PowerShell commands in this article, but the most functional commands will be our main focus.

PowerShell is already a pretty good tool for us. guide/help offers the output. Let’s run PowerShell and type help. As you can see, the differences between PowerShell and ordinary command lines are given in detail.

PowerShell is a new generation shell that is still under development. information may be out of date. We can enter the update-help command to avoid this situation. Böylece help dosyaları indirilip güncellenecektir.

Not: Bu komutu uygulamadan önce PowerShell’i yönetici olarak çalıştırmalısınız. Aksi takdirde başarısızlıkla sonuçlanır.

Normalde indirdiğimiz veya başka yollarla ediğimiz dosyaların bozulup bozulmadığını, orijinalliğini kaybedip kaybetmediğini öğrenmek amacıyla ek programlar kullanarak hash değerlerini karşılaştırırdık. PowerShell’in get-filehash komutuyla beraber artık buna gerek kalmıyor.

Bir dosyanın hash değerlerini elde etmek amacıyla get-filehash dosyaismi şeklinde bir komut girmeniz yeterli. Bu komudollarsa beraber herhangi bir takı kullanmazsanız varsayılan olarak SHA256 çıktısını eirsiniz. Eğer SHA256 yerine daha farklı hash algoritmaları kullanarak değerler elde etmek istiyorsanız -Algorithm algoritmaAdı takısını kullanabilirsiniz.

PowerShell, saymakla bitmeyecek kadar güzel özelliklere sahip. PowerShell kullanarak herhangi bir adresten kolayca dosya indirebilirsiniz.

Öncelikle New-Object System. Net. WebClient isimli objeyi bir sonraki komudollarsa beraber daha kolay kullanabilmek için bir değişkene atayalım. Ben indirici adında bir değişkene atamak istedim. Daha sonra bu değişkenle beraber . DownloadFile adında bir yapı daha kullanarak indirmemizi gerçekleştireceğiz. Son durumda bir nevi basit bir PS scripti oluşturmuş olacağız.

$indirici = New-Object System. Net. WebClient

$indirici. DownloadFile(“indirilecekDosyaURL”, “indirilecekdosyaKonumdosyaAdı”)

Ben Technopat’ın robots. txt dosyasını PowerShell ile indirmeyi denedim. Gördüğünüz gibi indirme işlemi başarıyla gerçekleşti.

PowerShell şüphesiz ki işinizi birçok alanda kolaylaştırabileceğiniz hatta otomatiğe bağlayabileceğiniz yeteneklere sahip bir kabuk. Herhangi bir amaca yönelik yazacağınız PowerShell scripti ile mini otomasyonlar hazırlayabilirsiniz. Microsoft bunu da düşünüp, kullanıcılara PowerShell ISE adında oldukça güzel bir geliştirme ortamı hazırlamış. Halihazırda Windows 10 ile beraber yüklü geldiği için herhangi bir kurulum yapmanıza gerek kalmıyor.

Windows sistemler hakkında bilgi emek, sistemi tanımak ve işlerini kolaylaştırmak isteyenlerin işine oldukça yarayacağını düşündüğümüz kabuk yapılarına ilk yazımızda, temel komut satırı kullanımına ikinci yazımızda ve dosya işlemlerine ise bu son yazımızda değindik. Böylece “Windows Komut Satırını Tanıyalım” serisinin sonuna gelmiş bulunuyoruz.

Aynı zamanda birçok alanda faydası dokunacak birtakım geliştirme ortamları ve yapılar hakkında da yeterince açık ve bilgilendirici olmayı amaçladık. Umarız ki çalışmalarınızda faydası dokunur.

Sizlerin de eklemek istediği komudollarsar veya konu hakkında görüşleriniz varsa yorumlarda belirtebilir, Windows sistemler hakkındaki sorularınız için Technopat Sosyal’e konu açabilirsiniz. Esen kalın.


Like it? Share with your friends!

346
133 shares, 346 points

What's Your Reaction?

hate hate
1226
hate
confused confused
736
confused
fail fail
368
fail
fun fun
245
fun
geeky geeky
122
geeky
love love
981
love
lol lol
1104
lol
omg omg
736
omg
win win
368
win
Michael Lewis

Emperor

0 Comments

Your email address will not be published. Required fields are marked *

Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
List
The Classic Internet Listicles
Countdown
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Meme
Upload your own images to make custom memes
Video
Youtube, Vimeo or Vine Embeds
Audio
Soundcloud or Mixcloud Embeds
Image
Photo or GIF
Gif
GIF format