Menu
Is free
registration
home  /  Advice/ How to hide a batch file during execution. How to hide bat window if cmd file is executing

How to hide a batch file during execution. How to hide bat window if cmd file is executing

There are times when you need to change a file attribute. Everyone knows how to do this through a conductor. But there may be a situation in which it is necessary to remove the attribute on the command line. It seems to be a trifle, but you need to know the commands. Therefore, today I decided to write this little instruction and show you how to remove the "Hidden" attribute on the command line.

If you have personal files on your computer that you would like to hide from prying eyes for one reason or another, I can advise you to use the AxCrypt program, which we talked about in the article

How do I remove the Hidden attribute from a folder or file?

As an administrator, open a command prompt. This is done like this:

Press the Win + R keys on the keyboard - this key combination will open the Run menu dialog box. In the window that appears, enter the cmd or cmd.exe command and click on OK.


Now we need to go to the folder in which we need to uncheck the "Hidden" attribute. To do this, enter the command in the command line:

cd / d "path to folder or file"

After the letter d there is a space and the path to your folder or file. In my case, it looks like this:

cd / D h: \

T.e. with this command, I will transfer from the "system32" folder located on the "C" drive in the "Windows" directory to the root directory of my flash drive, which in my case is called "H"


Now that we are in the directory we need, enter the following command:

attrib -S -H / S / D
How to remove a hidden attribute

This command removes the Hidden and System attributes from all files and folders in this directory.

This article describes various ways of hiding the cmd window while executing a batch file.

Batch files, aka batch files, are very useful for running a whole batch of commands. But, I think, many are wondering how to make sure that the console window does not appear on the monitor. I will focus on the built-in capabilities of the system, I will mention in passing the third-party programs. Along the way, we will solve some other problems, for example, by adding a separate label for the batch file.

How to bypass UAC protection? Refer to the article

How to hide the cmd window. Can this be done by means of the batch file itself?

No. The code works in the console environment, which means the window will be displayed. You need to come to terms with this: the window will be open as long as the code is executing. All you can do is take some steps to make the window appear for the shortest amount of time. In principle, this is useful: we can observe the work of the code with our own eyes. But if you want to hide the console window, you have to use third-party tools: other developers or the capabilities of Windows itself. Let's start with her.

Run the batch file silently. Windows only.

In the code frenzy file itself, you sing the song yourself. I will propose to optimize its content for the most quiet operation. There is an important point here: the shorter the code itself, the more likely it is that the console window will appear for a short time. If the volume is large or several commands are written at once, the window may attract attention.

For example, I will take a script code that allows a little (specifically, characteristics processor v System properties ). This is done for the duration of the Windows session: after the reboot, everything will fall into place.

In general, we have the following batch file code:

REGEDIT4; @ECHO OFF; CLS; REGEDIT.EXE / S "% ~ f0"; EXIT "ProcessorNameString" = "Intel (R) Core (TM) i112-3470 CPU @ 800.5GHz"

Pay attention to the characteristics of the processor. He will be responsible for changing system information. Name the file spec .bat. Also note that I will use only Latin characters in file names and avoid Cyrillic in the paths to their location, so that the path to the script can be read by the system correctly. Therefore, I will put the created bat file in the system directory - directly to the C: drive.

However, its launch is accompanied by:

  • the console window appears cmd
  • the appearance of a UAC window with a confirmation with the changes being made (the task, as you can see, has become more complicated by itself, because the system information is changing)

before executing the batch file, the UAC window appears

I suggest you get rid of the first window with the help of the following script, which is already in the next, vbs-file. And here is the script for it (see - my path to the file C: \ spec.bat):

"HideBat.vbs CreateObject (" Wscript.Shell "). Run" C: \ spec.bat ", 0, True

I will call it any name with the extension .vbs. Now the work of the batch file by clicking on the vbs -nik is accompanied only by the appearance of a window Account control: the fact is that the changes made by the batch file relate to the registry, and the system logically does not let it pass uncontrollably. How is the topic of a separate article:

However, we will digress a little from the topic of the article and finish what we started by creating a console hide file for the file ( vbs file) special label. In the Object location field, specify the path in the format:

Wscript vbs-path-to-bat-path

The label is ready (you can change its drawing via Shortcut properties). You can drop it to your choice in the Startup folder, place it in the Windows Scheduler or run it with a double click. There will be no console window.

How to hide the cmd window? Special programs.

There are a lot of them, they are lightweight and easy to use. The downside is that you need to download them, and install some of them. Here are the most popular ones:

  • Hidden Start (HStart)

Utility of a domestic manufacturer. I need to buy, I don't know the cost. However, with its help, you can hide the window once and for all, and it does not matter whether UAC confirmation is required or not - it can also be hidden:

For 32 and 64 bit versions. It does not require installation, it is supplied in the form of an executable file, which, when launched (on behalf of the administrator), immediately asks for the Windows root directory. We agree, and she is now with us:

The utility can do a lot of things, including changing the sound level, opening the drive trays, etc. For our case, to hide the cmd window, one could simply enter the command in the form:

Nircmd elevatecmd exec hide filepath

We did not get rid of the UAC window (elevatecmd exec is part of the command with a request for UAC), but we were not promised. And it is inconvenient to constantly write the full path to the file in the console, so we will immediately create a shortcut:

Nircmd cmdshortcut "~ $ folder.desktop $" "Batnik" elevatecmd exec hide file-path

How to hide the cmd window: batch turned into exe.

It is also an option. This is already the music of the higher spheres. To whom this utility is unknown, get acquainted - it comes in handy: Bat To Exe Converter. As you understood from the name, it turns the batch file into an executable file with the .exe extension. Download, install, use:

Good luck.

Read: 1 109

Sometimes there is a need to run bat file in invisible mode, hide, hide bat window... For example, if the file is executed through the scheduler. Or maybe a lot of commands are written there and it takes a long time to execute, while flickering before your eyes. Examples of what you need hide bat window file can be cited in many. So if you are interested in how hide cmd window or how to secretly run the program, read carefully.

I suggest that you familiarize yourself with the proposals of my partners

1.Using the vbs script. With such a script you can secretly run programs, bat files, other files.

Dim oShell Set oShell = WScript.CreateObject ("WSCript.shell") oShell.run "application path \ application name", 0 Set oShell = Nothing

For those who are not in the know, just copy the text into a notepad, put your paths to the application and the name of the application, save it under any name - but with the vbs extension, (for example, hide the start.vbs window)

Example: secretly launch the qwerty.bat batch file from the C drive

Dim oShell Set oShell = WScript.CreateObject ("WSCript.shell") oShell.run "C: \ qwerty.bat", 0 Set oShell = Nothing

Similar code

Set WshShell = CreateObject ("WScript.Shell") RetCode = WshShell.Run ("C: \ qwerty.bat", 0, False)

You can run in hidden mode not only * .bat but other files as well. For example, you want to run mp3 without the player window, provided you are using Windows Media Player

Set WshShell = CreateObject ("WScript.Shell") RetCode = WshShell.Run ("C: \ qwerty.mp3", 0, False)

If your mp3 is tied to another player, then add wmplayer.exe to the code

Set WshShell = CreateObject ("WScript.Shell") RetCode = WshShell.Run ("wmplayer.exe C: \ qwerty.mp3", 0, False)

2. The cmdow utility (place the utility itself in C: \ windows \ system32)

Hello friends! Do you know how to hide a folder so that no one else can get to it except you? Do not know? So, now in this short article I will describe to you in detail how you can hide your personal folders and protect them from unnecessary attention.

As you know, by default, any folder is created in its normal form, and it can be made hidden only later, asking her some attributes. In the course of the article, I will consider how this can be done using several methods:

  • Using file properties;
  • Through Total Commander;
  • Using the command line;

First, I recommend that you create a new folder and try to hide it in order to understand how it works, and only then proceed to the folder with your files. Well, come on, I'll finally show you how to hide a folder in Windows 7 and other operating systems.

Hide a folder using file properties

Hiding a folder using its properties is the easiest way that exists in Windows operating systems, although when you see it, you will see for yourself now.

Right-clicking on the folder, select the item " Properties».

The folder options will open, where, going down a little lower to the attributes section, check the box next to the “ Hidden"And don't forget to press the save buttons first" Apply».

If you have any files stored in the hidden folder that you also want to hide, then when the window “ Attribute Change Confirmations"You should check the box" To this folder and to all attached files". If, on the contrary, you only need to hide the folder, and leave the files unchanged, then mark the first option and click " OK". After that, the folder will receive the hidden attribute, and all attached files will remain unchanged.

How to hide a folder using Total Commander

In the second method, we will turn to the downloaded Total Commander program for help, thanks to which we can also hide any folder by setting the corresponding attribute to it.

Surely many of you already use this file manager, so I will not explain how to install it. The rest, who hears about it for the first time, should download it and install it on their personal computer.

So, launch Total Commander and use the navigation to navigate to the folder we need.

Now, by highlighting the folder with the right button, go to the menu, where we press " Files» – «».

A settings window will appear, where we will be offered a choice of four types of attributes " Archived, read-only, hidden and system". Since we have one goal with you to hide the folder, we accordingly tick the “ Hidden", And confirm our choice by clicking on" OK". That's all, as you can see nothing complicated.

Now I want to say a few words about the attribute “ Systemic". This attribute can also be classified as hidden. In general, see what happens if you check the hidden and system attributes together.

If you choose only " Hidden", Then the user will be able to see all the folders by turning on the simple display of files, but if additionally check the box" systemic", Then in this case, with a simple display of hidden files, it will not be visible.

Just in order to see the system files, in the properties of the folder view, you should uncheck the box " Hide system files and folders". About this, from the number of ordinary users, few people know, therefore, this attribute can be regarded as an additional type of security.

Hide the folder via the command line

This option is probably the most difficult one, because here you have to deal with the execution of commands in CMD, which many users do not like very much. But, I will consider it, since it is also performed using its own Windows utility, which is installed along with the system.

Well, let's get started, as usual when working with CMD, we call " Execute"By pressing a familiar keyboard shortcut Windows + R... A window will open in which, having written three letters " CMD"Click" Enter».

A command line will appear in which, in order to hide the folder, we will need to specify the attribute “ h”, Which is responsible for performing this action.

So, in order to hide the folder, execute this command: attrib + h “C: \ Papka”


I will explain a little on the command, so that you understand what's what:

  • attrib- execution command to change the attribute;
  • + h - an attribute that will give a hidden look to our folder;
  • "C: \ Papka" - the place where the hidden folder is stored ( you must specify your path to the folder);

After executing this command, the folder will become accessible only with the options for displaying hidden files enabled.

Through the command line, as well as through Total Commander, you can also specify the system attribute (which was described just above) by adding + s:

attrib + h + s “C: \ Papka”

By the way, after setting the system attribute, you won't be able to remove the hidden view from the folder using the file properties, as the attribute will simply not be available.

For those who nevertheless changed their minds about hiding their files, now I will show you how all this can be returned back. Basically, you don't need to do anything complicated, just change a few symbols in the command and that's it, our folder will have the same appearance as if nothing was done with it.

attrib -h -s “C: \ Papka”

Making the folder invisible by changing the appearance of the icon

For those who do not want to bother with all these attributes, I have one more simple and interesting advice. Its simplicity is that we can hide our folder without hiding it completely, but by setting only a transparent icon and an invisible name. Do you know how you can do this? No? Then let me show you this.

So, having called the properties of the folder, go to the tab " Settings"And click on the button" Change Icon».

In the appeared abundance of icons, select any empty space and click " Ok».

As a result, you should see something similar in front of you.

So, now we just have to hide the name, for this we select the folder and press “ F2"To rename the file. Now, holding " ALT", Hold it down and write a set of numbers like this: 255 , after which we release all the keys and press “ Enter". As a result, there will be nothing on the screen except that a dotted line around the hidden folder.

As always, in conclusion, I advise you to try all the options and choose the one that you like. I do not tie you to any one, since they are all working and not very complicated.

These recommendations will help you hide your personal information from ordinary users who are not particularly versed in all the intricacies of working with a computer. So, as more experienced users probably know about these ways to hide the folder, and they will probably be able to find them. Therefore, if you really need to hide something, you hide the folder, but store it a little deeper, on the D drive, for example, and not on the desktop.

Three easy and convenient ways to hide a folder in Windows