Even if you’re not an expert, I’ll explain to you right away what batch files are, which are the most famous type of file (the .bat) in Windows after the .exe (executable).
This article, however, will talk about a curious Windows problem that can be created with batch files, therefore we will not be responsible for the misuse of this information.
What are batch files in a nutshell
A batch files (or “batch script file”) is a type of text file that contains a set of commands for the Windows operating system. These commands are executed one after the other in sequence when starting the extension file .bat.
The .bat file is a useful way to automate repetitive or complex tasks, such as copying files or running a set of programs. Instead of having to manually type each command, you can write a .bat file that executes them automatically.
The .bat file is written using notepad or another text editor, and usually has the “.bat” extension. The contents of the .bat file consist of Windows command prompt commands, such as the “cd” command to change the current folder or the “dir” command to list the files in the current folder.
Once the .bat file has been created, it can be run by double-clicking the file. The Windows operating system will open a command prompt window and run the commands contained in the batch file in sequence.
In summary, a .bat file is not chand a text file containing a series of commands for the Windows operating system, which allows you to automate repetitive or complex tasks.
It can be said that it is very similar to programming.
But these files can become a double-edged sword
The .bat files can be started from the Windows “autorun” function, let’s assume that you don’t have a working backup battery and you want to synchronize the time, starting a .bat file with the command that synchronizes the time can be a solution temporary.
The powershell commands are:
@echo off
net start w32time
w32tm /resync /nowait
Obviously in a batch file that could be called for example “tymesinc.bat” and subsequently placed in Startup, the shortest method is Windows key + R and shell:startup, then just put the file you just created in the folder that appears.
Yet with this useful trick, if you want you can be annoying
With batch files, in addition to synchronizing the time, I can make the PC shut down or restart: What if I wanted to create a command that turns it off every time I start my computer?
Well it is very doable and very easy.
@echo off
set “startup_folder=%APPDATA%MicrosoftWindowsStart MenuProgramsStartup”
set “shutdown_file=%startup_folder%shutdown.bat”
echo shutdown /s /t 0 > “%shutdown_file%”
Running this batch file yes will create an additional batch file which will shut down the PC in zero seconds (the last command).
If I wanted to make the file more credible on a (deceptive) email trap, there is an application called Bat to Exe converter, able to make the batch file an executable file, if you then add a credible icon with other programs, that’s it.
This is but a very simple and very early example of a virus which I strongly advise against starting on your computer if you don’t want continuous shutdowns.
While some .bat files are likely to be recognized as viruses, if something like this were to pass the antivirus check it would be very difficult to remove this threat for an inexperienced person.
It is not known if this problem is known by the Windows authors, if it is an oversight or a deliberate thing, of course if someone were to run into such a problem with an .exe file sent via a deceptive email, it would be very annoying.
In addition to annoying needless to say that a PC that shuts down continuously in the long run is ruined.
That said, now that you know it’s so easy to create something that looks a lot like a virus: watch out!
#Batch #file #creating #simple #virus #Windows