How to close a program via the command line, bat file in Windows and terminal in Linux

How to close a file

You can close an open file in Task Manager

.
To do this, you need to enter the Manager
, select the running application (the one you want to close).
Then click the End task
. The application will be closed.

But all this is good and works great if we want to perform some actions with a file open in some program, for example, in Word. In this case, a warning is issued indicating in which program the file of interest is opened.

But we received a warning that the file is opened in system . This means that the file is open in some system utility program. But such programs are not displayed in the Task Manager. The applications section will show files and applications that we, in fact, open ourselves. We will not see files opened in the system.

Third party programs

You can unlock objects using special software. After that you can erase them. Such utilities are very easy to work with. They have a clear interface and a minimal set of options. They themselves are compact, weigh little and do not require resources. You'll quickly figure out how to close a file in Windows 7 Explorer.

  1. Find it on the Internet, download, install and run.
  2. You will see a window with a menu bar and an empty table. It will contain information about the selected elements.
  3. Command "File - Open".
  4. Specify the path to the object you want to erase. It will appear in the workspace of the unlocker program.
  5. Right-click on it.
  6. Select "Unblock".
  7. The “Status” column should read “Successfully Unblocked.”
  8. You can then delete the item.

There are often cases when you want to move, rename or delete a file, and a dialog pops up telling you that the file is open in the system

, and therefore the operation cannot be completed.

Naturally, the first thing that comes to mind in this case is to look in the Task Manager. If the file is shown in the Applications section, then everything is simple. You just need to close this file.

How to close a file opened in the system

What to do if the dialog box about the impossibility of completing the operation (the file is open in system) pops up regularly, but the system program is not displayed in the Manager. We see there only a running application - a dialog box.

How can I close or delete the file from the system in this case? There are several options here and we will consider them from simple to complex.

First of all, you need to pay attention to what kind of file you want to close and its extension. Most often this happens if we want to delete or move an image file with an .iso (or some other) extension.

The simplest thing you can do in this case is to check the virtual drives.

In one of them you will probably find a mounted file.

This will be the file opened in system. The fact is that all disks, including virtual ones, are managed by a system utility program. And while the file is in the virtual drive, if you try to perform any actions with it other than opening, a warning will be issued about the impossibility of completing the operation because the file is open in
system
.

It would seem that in this case you can right-click on the drive and Eject

file from the drive.
But this function doesn't actually work like ejecting a real disk from the drive. If we click Eject,
the file will be removed from the drive, but will remain on the system and we will still not be able to close or delete it.

But there is a simple and effective way to close a file in system . You just need to... restart your computer. After the reboot, check if the file has disappeared from the drive, you can perform scheduled operations. There will be no warning dialogue.

It's simple and good, but... it doesn't always work. To be more precise, this works if Automatic mounting is not checked in the settings of the program that creates virtual drives, for example, Daemon Tools .

If the checkbox is checked, then when you restart the computer, all recently mounted files will be automatically remounted.

Thus, if you want to close files opened in the system by simply restarting the computer, uncheck the box Automatic mounting Daemon Tools . If this does not suit you, then you can do differently.

Close Explorer

There is no point in removing used files. You won't be able to erase them while they are active. But you don’t have to look for them in the “Dispatcher” to close them. You can disable the conductor itself. Better yet, restart it.

If you do something wrong, errors will occur. This is still a system service, not a user program. You should not close it if you plan to continue working on the computer.

Here's how to delete a file from File Explorer:

You can do it another way:

  1. Go to Start.
  2. Hold down the Ctrl+Shift keys and right-click on any free space. Not by the logo, but precisely in the area where the list of shortcuts is located.
  3. Select "Exit Explorer" from the context menu.

To run it:

  1. Press Ctrl+Shift again.
  2. Right-click on “Start”. This time by the icon itself, and not by the area “inside” the main menu.
  3. The line “Open Explorer”.

We use the "batch file"

Friends, if a certain program has seriously spoiled your nerves by constantly starting up and slowing down the system, then you can, when necessary, quickly close it through a bat file (in common parlance, a “bat file”), which must first be created. In this case, you won’t have to constantly access cmd and enter the same command ten times a day.

The body file is constructed as follows:

  1. Create a new text document (Notepad), by right-clicking on an empty space on the desktop, go to the New tool and select the appropriate item.

  1. Open the resulting document with two quick clicks and enter the command taskkill /F /IM zoom.exe into it (my name is zoom.exe, you enter the name of your problematic utility).
  1. Through “File”, go to the “Save As...” tool, set any name (I wrote “Close”), after it put a dot and write the bat extension (see photo).
  1. Click “Save” and a batch file will appear on your desktop.

When the ill-fated program starts again and boots the PC, quickly double-click on the prepared bat file to close it.

Simple universal removal method

Universal removal method

Regardless of the reason, first of all, you should use the simplest and most accessible method, which is universal. It involves performing the following actions:

  1. Close all active and minimized program windows.
  2. Restart your PC. As a result, all programs will be automatically closed, including those running in the background. In addition, in case of some failures, a regular reboot completely normalizes the system.
  3. Boot into safe mode. As you know, certain programs are configured to autoload - therefore, they are able to open files even before the user can perform any actions. When entering safe mode, most programs do not start, which means files do not open.
  4. Perform an unscheduled anti-virus scan of your computer. This procedure will be useful if access to certain files has been blocked as a result of a virus infection.

Closing active and minimized program windows

In most cases, this is enough for the system to recover, and unnecessary files can be deleted without problems. But if this does not help, you should use other specific features.

Task Manager

The frozen item may not be on the taskbar. You won't see it even if it's open. But you don't need to restart your computer. Windows 7, 8 and 10 have a service where you can view and selectively disable running programs. Here's how to close a file in Explorer:

  1. Press Ctrl+Shift+Esc or Ctrl+Alt+Delete.
  2. The Task Manager will appear.
  3. On the Applications tab, find the item you can't get rid of or the utility associated with it.
  4. Highlight this item.
  5. Click on “Cancel task”.
  6. Try erasing the element that is not being deleted.

The program can be “hidden” in background processes. This means that it is not visible, but at the same time it works and is used by the system. And how to remove an item without restarting the PC? The same Task Manager will help.

  1. Open it and go to the "Processes" section.
  2. Find the application process there. Usually its name is the name of the executable file.
  3. Click on it and click Finish.
  4. If you don’t know what this program is and what it is responsible for, it’s better not to risk it. You may accidentally disable a system process.

Close Explorer

There is no point in removing used files. You won't be able to erase them while they are active. But you don’t have to look for them in the “Dispatcher” to close them. You can disable the conductor itself. Better yet, restart it.

If you do something wrong, errors will occur. This is still a system service, not a user program. You should not close it if you plan to continue working on the computer.

Here's how to delete a file from File Explorer:

You can do it another way:

  1. Go to Start.
  2. Hold down the Ctrl+Shift keys and right-click on any free space. Not by the logo, but precisely in the area where the list of shortcuts is located.
  3. Select "Exit Explorer" from the context menu.

To run it:

  1. Press Ctrl+Shift again.
  2. Right-click on “Start”. This time by the icon itself, and not by the area “inside” the main menu.
  3. The line “Open Explorer”.

Free Unlocker to unlock files that won't be deleted

The Unlocker program is probably the most popular way to delete files that are used by a particular process. The reasons for this are simple: it is free, it does its job properly, and in general, it works. You can download Unlocker for free on the developer’s official website https://www.emptyloop.com/unlocker/ (the site has recently been identified as malicious).

Using the program is very simple - after installation, just right-click on the file that is not being deleted and select “Unlocker” from the context menu. If you are using the portable version of the program, which is also available for download, launch the program and a window will open to select the file or folder you want to delete.

The essence of the program is the same as in the first described method - unloading from memory the processes that are occupied by the file. The main advantages over the first method are that using the Unlocker program it is easier to delete a file and, moreover, it can find and terminate a process that is hidden from the eyes of users, that is, not viewable through the task manager.

Update 2020: Another method, judging by the reviews, works successfully, was proposed in the comments by the author Tokha IT specialist: install and open the 7-Zip archiver (free, works also as a file manager) and rename the file in it, which is not deleted. After this, the removal is successful.

How to delete a file from system

You can delete a file from the system without restarting your computer. Let's look at this feature using an iso file as an example. First, we check its presence in the virtual disk. If it is there, you just need to unmount it.

It is more convenient to perform the operation of unmounting a file in Daemon Tools. When you open this program, you will see all the virtual drives and all the files mounted on them.

Right-click the drive with the file we need and select Unmount.

And that’s it... you can delete the file, there will be no warning that it is open in the system.

Moreover, in Daemon Tools you can delete files from the system, even if they were previously mounted in another program, for example in UltraIso.

Using the UltraIso program, you can also unmount a virtual drive, and, therefore, remove it from the system, but only if it was previously mounted in it.

Thus, before deleting a file from the system

, you must first unmount the virtual drive.

Removing files from the system using the Unlocker utility

You can also delete files opened in the system using the Unlocker

. This is a free utility. It allows you to delete almost any files controlled by system processes, including system. But you need to use it carefully. It can also remove system files.

How to delete a file or folder in Explorer?

You can also use several methods to delete a file or folder. For any method, you first need to select the file to delete. Further.

Þ Drag the file/folder icon onto the Trash icon.

Þ In the Explorer window, select a file and use the “File” and “Delete” menu items.

Retrieving a deleted file or folder back

When displaying the log, renames and copies are automatically detected. But the file or folder is not lost at all. If you know a file or folder has been deleted, open the repository browser and switch to that revision. Refer to the Repository Browser section and the Conversation Log section to learn more. Enter a new name for the element and you'll be done.

Addressing filename conflicts

If you want to move files within your work tree, perhaps to a different subfolder, you can use the right-click drag and drop handler. So simply renaming the file using Explorer's rename command likely won't work. The easiest way is to do this in a logger-specific file system, and then commit and push the changes.

Þ Right-click on the icon of the selected file and select the “Delete” command in the context menu.

Þ There is a delete button in the Explorer toolbar.

What tasks does the “My Computer” icon allow you to solve?

The My Computer icon allows you to access any file and device on your computer. To launch “My Computer,” you need to double-click on its icon.

If you want to keep both or more files with the "same" name but a different new name, do this for all the files in question and rename them before continuing with the next .

  • Uncheck only one element that you want to keep.
  • Return deletion of the file you are looking for to get it back.

But what if you want to clear all ignored elements to create a clean build?
Removing laptops is not as easy as you think. When you delete a laptop, it is moved to the Trash, where you can permanently delete it. The My Computer application has almost the same capabilities as Explorer. The only difference is that the work area of ​​the My Computer window consists of one part, identical to the right half of Explorer. Those. there is no hierarchical list of files and folders.

Double-clicking on the “My Computer” icon will display a window with a list of all computer drives. Double-clicking on the icon of the desired disk will open a window with the contents of this disk - a set of its folders and files. Double-clicking on the icon of the desired folder will open a window with the contents of the folder. Etc.

Removing a laptop from a computer

Any items in the laptop cannot be recovered after removing the laptop from the trash. The notepad doesn't go away for long until you empty the trash. Keep in mind that anyone with whom you shared the notebook can no longer access the file. Among the channels most used by malware, .

The global network is the main source of distribution of all types of malware. The malware can enter the computer if the user. First, attackers trick a user into visiting a specific website through spam messages distributed via email or posted on Internet message boards. This site contains code that redirects the request to a third-party server containing the exploit. Once an operating system type is detected, the corresponding exploit is activated. If the attack is successful, a Trojan is installed on the user's computer, allowing attackers to control the infected computer. Previously, malicious people were used to create malicious websites, but recently they have managed to infect legal websites.

  • Accessing a website containing malicious code.
  • The drive attack is performed in two stages.

Email messages received by users and stored in email databases may contain viruses.
Note. If you hold down the Ctrl key while double-clicking, a new window will not appear. The contents of the selected folder will appear in the previous window (where you double-clicked). This approach will allow you to avoid cluttering your desktop with My Computer windows.

What are the ways to launch applications in Windows 95?

Malicious attachments can be found in the message body, as in an attachment. You can infect your computer after opening a message or after saving an attachment. In addition, email messages can lead to two more threats: spam and scams. The only undesirable consequence of reading spam is wasting time.

Removable storage media

Software vulnerabilities are the most common source of attacks by cybercriminals. The vulnerabilities allow you to remotely access your computer, which will allow you to control your data, your local network resources and other sources of information. When you run a file located on removable media, you can infect your computer's data with viruses.

You can use different methods to launch applications in Windows 95:

1. “Start” button, “Programs” submenu - and select the desired application from the list that appears.

2. If there is an application shortcut on the desktop, then double-clicking the left mouse button will give a command to execute the application.

3. Find the application in the Explorer window and double-click on its icon.

Security 101: Types of Malware

Some users may install applications that appear to be safe, but actually infect their data. This method is called "social engineering" because virus writers can force the victim to install the virus themselves. After installing the application, update the databases and perform a full scan. To understand what types of threats exist to your data, it helps to know what types of malware exist and how they work. In general, malware can be divided into the following classes.

4. Select the application in the Explorer window and execute the Open command from the File menu.

5. “Start” button, “Run” submenu and in the window that appears, enter the name of the application.

6. Give a command to open the corresponding document and the application will launch automatically.

Programs that infect other programs by adding their own control code after running infected files. The main purpose of a virus is to infect. The speed of spread of viruses is slightly lower than that of worms. This type of malware uses network resources to spread. Its name means that they can penetrate from one computer to another, like a worm. Its spread speed is very high.

When a worm penetrates a computer, it tries to obtain the addresses of other computers on the network in order to begin sending copies of itself. They also typically use email client contact book data. This type of malware includes a wide range of programs that take action without the user understanding it and without their consent: they collect data and send it to criminals; destroy or modify data with criminal intent, causing computer malfunction or using computer resources for criminal purposes, such as mass spam.

What problems can you use the Paint graphic editor to solve?

The Paint graphic editor is designed for creating, viewing and editing various graphic images. With its help, you can create both arbitrary drawings and mathematical drawings and diagrams. Finished drawings can later be inserted into text documents.

They are not classic viruses because they do not infect other programs or data. Trojans cannot penetrate computers themselves, but are distributed by criminals under the wing of some kind of “desirable” software. They are capable of causing much more damage than classic viruses.

What tasks does the “My Computer” icon allow you to solve?

Their presence may be completely invisible to the user. They can collect data about user actions, hard drive contents, installed software, connection quality and speed, etc. There are at least two known programs that also allow you to control equipment. Another example of spyware is programs that install code in the Internet browser to redirect traffic. You may have seen how they work when another web page opens instead of the requested one.

· Drawing straight and curved lines of various thicknesses and colors.

· Pencil - when the left mouse button is pressed, a trace of the selected color, 1 pixel thick, is drawn behind the mouse cursor. When the left button is released, the trail is not drawn.

· Brush - the action is similar to a pencil, but you can change the shape of the brush - circle, square, line, etc.

· Spray - painting with the effect of spraying paint.

· Eraser - for erasing part of the drawing. You can change the eraser size. The removed area will be filled with the background color.

· Fill—allows you to paint the inside of an arbitrary closed area with the selected color. This requires clicking anywhere within the area. If the area is not closed, then the entire work area will be painted.

· Line—designed to draw a straight line (segment) of the selected color and thickness. The ends of the segment are the places where the left mouse button was pressed and released.

Sometimes when deleting files in Windows, the user receives a message that the operation cannot be completed with the notification “The file is open in another program.” Let's consider several options for solving this problem.

Determining the user who opened a file in a network folder using Openfiles

To remotely determine the user who opened (locked) the cons .adm in a network folder on the mskfs01 server, run the command:

Openfiles /Query /s mskfs01 /fo csv | find /i "cons.adm"

/ i switch is used to perform a case-insensitive search.

You can only specify part of the file name. For example, to find out who opened an xlsx file whose name contains the string farm, use the following pipeline:

Openfiles /Query /s mskfs01 /fo csv | find /i "farm"| find /i "xlsx"

You can, of course, find an open file in the Computer Management graphical console, but this is less convenient (there is no search option in the console).

Removing a locked file using a bootable USB flash drive or disk

Another way to delete such a file is to boot from any LiveCD drive, system recovery disk, or Windows bootable USB flash drive. When using LiveCD in any of its variants, you can use either the standard Windows graphical interface (for example, in BartPE) and Linux (Ubuntu), or command line tools. Please note that when booting from such a drive, the computer's hard drives may appear under different letters. To ensure that you are deleting a file from the correct drive, you can use the dir
c:
(this example will display a list of folders on the C drive).

When using a bootable USB flash drive or installation disk for Windows 7 and Windows 8, at any time during installation (after the language selection window has already loaded and in the following steps), press Shift + F10 to enter the command line. You can also select "System Restore", a link to which is also present in the installation program. Also, as in the previous case, pay attention to possible changes in drive letters.

Deleting a file without additional programs

The file is already in use. Close the file and try again.

As a rule, if a file is not deleted, then in the message you will see which process is occupied by it - it could be explorer.exe or some other problem. It is logical to assume that in order to delete it, you need to make sure that the file is “not busy”.

This is easy to do - launch the task manager:

  • In Windows 7 and XP you can access it by Ctrl + Alt + Del.
  • In Windows 8 and Windows 10, you can press the Windows key + X and select Task Manager.

Find the process that is using the file you want to delete and kill the task. Delete the file. If the file is occupied by the explorer.exe process, then before canceling the task in the task manager, run the command line as an administrator and, after canceling the task, use the command del full_path_to_file

to remove it.

To return to the standard desktop view after this, you need to run explorer.exe again; to do this, in the task manager, select “File” - “New task” - “explorer.exe”.

Third party software

We can also resort to the services of one of the utilities that allow us to automatically close processes and delete objects in the form of a folder that we do not need. Let's look at three such applications at once so that you have a choice.

Unlocker

The first program is the most popular. If someone says how to delete a folder when it says that it is open in another program, then Unlocker is automatically implied. Well, let's start with it:

  1. Go to the official Unlocker website and download the latest Russian version of the program via a direct link.
  2. When the installation file is received, launch it and install the application.
  3. Now we launch our application (of course, it will only work as an administrator) and select the folder that does not want to be deleted in the Explorer window that appears.
  1. When the small Unlocker window appears, select the delete function from the drop-down list and click “OK”.

The program will automatically complete the process that prevented us from deleting our folder and erase it from the computer.

Sometimes it happens that our utility is unable to immediately delete a directory. In this case, the user needs to restart his computer or laptop and the removal will be performed when the operating system starts.

DeadLock

The second application in our list of automatic utilities for deleting a folder that is not deleted because it is open in another program is DeadLock:

  1. We go to the official website of the program we need and download its latest Russian version from there.
  2. When the file we need is received, we install it.
  3. Using the main menu of this application, open a folder that is not deleted. Further, using the remaining items of the main menu, we can either simply remove the lock or delete the directory automatically.

Like the previous utility, this software only works under an account with administrator rights.

LockHunter

The last program on our list that can delete a folder if it says it is open in another program is the so-called lock hunter. Let's take a quick look at how to install and use it:

  1. As in the two previous cases, we go to the official website of the program we need. Then we download it from there.
  2. We install the application following the prompts of the step-by-step wizard. When the process is completed, launch LockHunter.
  3. When the application starts, at the top of it, using the button with the image of three dots, we find the folder that we cannot delete. When an object is selected in the main program window, you will immediately see the process that is blocking the folder. From here you can either immediately delete the directory or unblock it.

This is one of the most convenient applications as it has a more visual user interface and is able to display the name of the process that is locking the object.

Computer management

Windows 7 and other versions of Win OS have another useful feature. Here's how to use it to close a file in Explorer:

  1. Go to Start - Programs - Administrative Tools.
  2. Find the “Computer Management” service there and click on it.
  3. The left column will contain a list in the form of a hierarchy. Expand "Shared Folders".
  4. Right-click on the "Open Files" directory.
  5. You need the “Disable all” option.
  6. You can go to this directory and select a specific object.
Rating
( 1 rating, average 4 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]