Windows Maintenance Programs
Computer maintenance can be both physical (dust removal, etc.) and software. The second is more related to the operating system, since the software maintenance of the PC itself at home…

Continue reading →

Code optimization
In the process of writing code, it is impossible to detect all errors and correct them. Writing a code, especially in large volumes, is a monotonous thing, somewhat tedious and…

Continue reading →

How to improve the noise characteristics of the system unit of a personal computer
When using a home personal computer to watch movies, listen to music or browse the Internet, especially at night, the noise of the system unit becomes especially noticeable. Permanent noise…

Continue reading →

Bat files, examples

You can perform all the examples published below not only by creating and running a BAT file containing these commands, but also copying them directly to the command line.

To open the command line in the right place (in the folder with files, for example), you need to call the context menu (RMB) with the Shift key held down:

command line call

You can read about how to work with the command line in this article. We pass directly to the teams.

A list of all console commands with a description can be obtained by typing help in the console
Help for any command can be obtained using the /?
For example: DIR /? displays help for all keys of the DIR command

Delete temporary files before shutting down your computer
I think everyone at least heard about sms viruses or came across them personally. The bat-file will help you to shut down the computer correctly by deleting temporary files, the folder with which the virus usually loads.

At the next boot of the device (at an early stage), the virus makes entries in the registry, disrupting the normal operation of the system. And when the desktop boots, the situation is more difficult to fix.

Of course, not all viruses work according to this scheme, but nevertheless, clearing temporary files and the system cache before shutting it down significantly reduces such risks.

start / wait “” “C: \ Program Files \ CCleaner \ CCleaner64.exe” / auto
start / wait “” “C: \ WINDOWS \ System32 \ shutdown.exe” / s / t 10
CCleaner is not installed by default on Windows. It needs to be installed separately. You can download the installer on the developer’s website.

The CCleaner program starts first and deletes all temporary files on the computer. Then the computer shutdown program starts with a delay of 15 seconds to avoid possible conflicts with CCleaner.

You must create a .bat file and copy this example into it. Display the shortcut to the bat-file on the desktop, assign it a beautiful icon and turn off the computer using this shortcut-button.

Get a list of files in a folder using a bat file
I periodically use bat-files to get lists of files in folders. A frequent situation: for work, clients send an archive with photos from the photographer. Photos are named according to the article numbers.

There is no textual information accompanying the photograph. You need to make a list based on the photos sent and import it into the product catalog on the site. For each product, several photos were taken. They are named like this:

Photo of the product with the article A1234.jpg
Photo of the product with the article A1234 (2) .jpg
Product photo with article B1234.jpg
Photo of the product with the article B1234 (2) .jpg
First, I get a list of all the files in the folder with the following command:

dir * .jpg / B / L> filelist.txt
The * .jpg command will allow only JPG files to be considered when compiling a list. The / B switch allows you to get a list containing only the names of the files in the folder. The / L switch will print all lowercase names. The command> filelist.txt will create a text file named filelist and write the result there.

The next step is to get rid of duplicates, so that only one entry is left in the list for each product:

type filelist.txt | findstr / I / V “(2)”> temp.txt
The findstr command will search the previously received file. The / I switch allows you to search for case insensitive entries, and the / V switch records lines that do not match the match. The quotation mark indicates the string whose coincidence you want to fix. And the last command> temp.txt will write to the temp file all the results that do not contain the name “(2)”. As a result, I get:

Photo of the product with the article A1234.jpg
Product photo with article B1234.jpg
And further on the basis of this text list I will prepare a file for import.

If you need to carry out the opposite operation – output only matches to the temp.txt file, then you will not find the needed one in the list of commands (findstr /?). There is only an inverse filter by exact match – / X.

For this task, you can use the command to output line numbers / N in which there are matches (numbers are displayed together with the line):

type filelist.txt | findstr / I / N “(2)”> temp.txt
The main thing when working with text information (text files) is to remember one thing:

If for text operations you use a file that you did not create through the command line as the source, it must be in the encoding that is understood by the command line. For example, CP1251 (ANSI).

Otherwise, you run the risk of getting something like this:

wrong encoding

Copy directory tree without files
When I start making new projects, it becomes necessary to get a directory tree similar to the old project tree with the difference that there should not be any files in it. For a new project, it is easier to add 3-5 files to the desired empty folders than to copy an existing project and then delete the unnecessary from there.

To get a directory tree without files, use the following command:

xcopy folder_1 folder_2 / T / E
The xcopy command takes as a basis the directory tree at folder_1 and creates a copy of it in the folder folder_2.

Removing SMS viruses
Recently, viruses that require sending SMS have become a very popular and profitable type of money withdrawal from cybercriminals. As a result of this, a lot of varieties of SMS…


Removing SMS viruses
Recently, viruses that require sending SMS have become a very popular and profitable type of money withdrawal from cybercriminals. As a result of this, a lot of varieties of SMS…


Online Programs
With the development of the Internet, cloud services and various online software are becoming more widespread. Some of the services are paid, but mostly services at such sites are provided…


A bit about CCTV systems
When it comes to business security, peace of mind for the life and health of relatives, it is necessary to carefully approach the choice of security system. Over the past…