Cmd hide cmd windows

Hide the Console in Batch Files

If we run a batch file by starting it manually, we usually don’t mind seeing the «black square» of the console window.
If, on the other hand, we run a batch file scheduled, or remotely, we often would prefer not to see the «black square» at all.

Several tools and techniques exist to hide a console window.

Start a batch file minimized

The most simple solution is to run the batch file minimized.
The batch file will still be visible in the task bar while running.
For batch file started by a shortcut, this may be «sufficiently hidden».

See this JSIFaq tip on how to make a batch file start another batch file hidden (uses a temporary VBScript file).
Note that, because the script is created and called by a batch file, there will still be a visible console window.

Or download and use my RunNHide.vbs or RunNHide.exe.

Make a batch file minimize its own console

Use one of the following commands within a batch file to minimize that batch file’s console window:

Make a batch file hide its own console

Use one of the following commands within a batch file to hide that batch file’s console window:

Spoiler alert: completely hiding the console is not possible in the standard command interpreters CMD.EXE or COMMAND.COM.
All techniques to hide the console that have to be called from within the batch file will always show at least a short «black flash» of the console being opened before it is hidden.
Therefore, the «cloaking» of the console has to be started before starting the batch file, which means using an alternative scripting language to start the command interpreter hidden.

To restore console visibility, use:

Start a batch file minimized

If a console window is visible already, but you want to start another batch file minimized, use one of the following commands:

Start a batch file hidden

If a console window is visible already, but you want to start another batch file hidden, use one of the following commands:

Run a batch file completely hidden

To completely hide the console, a Windows (GUI) executable or an alternative scripting language with GUI based interpreter (e.g. VBScript with WSCRIPT.EXE) has to be used.
Do not use the following commands in a batch file, as this batch file will run in a (visible) console window itself.

Make sure the batch file closes its own window in all circumstances, because you won’t be able to see whether it does close or keep running «forever».

Источник

Как спрятать окно cmd при исполнении batch?

В статье описываются различные способы того, как спрятать окно cmd во время исполнения batch файла.

Батники, они же batch файлы, бывают очень полезны для запуска целого пакета команд. Но, думаю, многие задаются вопросом, как сделать так, чтобы окно консоли при этом не появлялось на мониторе. Основной упор я сделаю на встроенные возможности системы, упомяну вскользь программы сторонних разработчиков. Попутно мы решим некоторые другие задачи, например, добавив отдельный для батника ярлык.

Как миновать защиту UAC? Обратитесь к статье Как обойти UAC в Windows

Как спрятать окно cmd. Можно ли это сделать средствами самого батника?

Нет. Работа кода производится в среде консоли, а значит окно будет отображаться. С этим нужно смириться: окно будет открытым до тех пор, пока исполняется код. Всё, что вы можете сделать, это предпринять некоторые шаги, дабы окно появлялось на минимальный отрезок времени. В принципе это полезно: работу кода мы можем наблюдать воочию. Но если хочется скрыть окно консоли, для этого придётся использовать сторонние средства: других разработчиков или возможности самой Windows. С неё и начнём.

Запустить batch файл незаметно. Только Windows.

В самом файле “безумству кода” вы пойте песню сами. Я же предложу оптимизировать его содержание для максимально тихой работы. Здесь есть важный момент: чем короче сам код, тем больше вероятность того, что окно консоли появится на короткое время. Если объём большой или прописывается сразу несколько команд, окно может привлечь внимание. Для примера возьму код скрипта, который в Windows 7 позволяет немного изменить системную информацию о компьютере (конкретно, характеристики процессора в Свойствах системы ). Делается это на время сеанса Windows: после перезагрузки всё станет на свои места.

Вобщем, имеем следующий код батника:

] «ProcessorNameString»=»Intel(R) Core(TM) i112-3470 CPU @ 800.5GHz «

Однако его запуск сопровождается:

перед исполнением батника появляется окно UAC

Однако мы немного отвлечёмся от темы статьи и закончим начатое, создав для файла сокрытия консоли (vbs-файла) специальный ярлык. В поле Расположения объекта укажем путь в формате:

Смотрите:

Ярлык готов (можете сменить его рисунок через Свойства ярлыка). Его можно закинуть на выбор в папку Автозагрузки, поместить в Планировщик Windows или запускать двойным щелчком мыши. Окна консоли не будет.

Как спрятать окно cmd? Специальные программы.

Их немало, они легковесны и просты в использовании. Минус – их нужно скачивать, и некоторые устанавливать. Приведу самые популярные из них:

Утилита отечественного производителя. Нужно покупать, стоимости не знаю. Однако с её помощью можно скрыть окно раз и навсегда, и не важно, требуется ли подтверждение UAC или нет – его тоже можно скрыть:

Читайте также:  Mediacreationtool exe windows 7

Для 32-х и 64-х битных версий. Установки не требует, поставляется в виде исполнительного файла, который при запуске (от имени админа) сразу просится в корневой каталог Windows. Согласимся, и она теперь с нами:

От окна UAC не избавились (elevatecmd exec и есть часть команды с запросом на UAC), но нам и не обещалось. И постоянно прописывать в консоли полный путь к файлу неудобно, потому сразу создадим ярлык:

Как спрятать окно cmd: batch превратился в exe.

Источник

10 Ways To Run Batch Files Silently And Hide The Console Window

Most ordinary Windows users never use the Command Prompt and have no idea what sort of things you can do from the command line. More experienced users will know that running command line commands can be very useful for a range of tasks and grouping everything into a single batch file to process it all together can be very powerful.

One inconvenience with running batch files is that they always open a console window which shows the output of the commands being executed. This can be important if you want to interact or see what is happening while the batch file is running but a bit annoying if you want to run the batch script quietly in the background or while starting windows.

For short batch files, the console window may appear and disappear in a flash or stay open for longer if more commands are being executed. There is no standard built in way to completely hide the console window from showing so if you want to do that another solution is required. Here we show you some different ways to make your batch script run silently without a console window showing.

Run a Silent Batch Script Using a Third Party Utility

A simple and common solution for running a batch file silently is launching it via a third party utility that suppresses the console window.

Hidden Start (HStart)

Hidden Start is a portable and quite powerful tool that can launch executables and scripts with several useful options. We are using version 4.2 from 2013 because it’s portable and not as restricted as newer versions. Since version 4.3, Hidden Start is no longer portable and also pops up a nag every time you try to run a hidden console, which makes it useless for this purpose.

Unzip and run the program with HStartUI.exe, the process consists of three steps. Manually add or drop your batch file onto the window, make sure “Hide console window” is checked and optionally check “Run with highest privileges” if your script requires it. Other setup options like priority or starting directory are not essential unless you know the script requires them.

Step 3 shows the output command that has to be manually run. You can use the buttons at the bottom to copy the command, automatically create a shortcut or add an autostart entry into the registry. Note the bypass UAC prompt option is not available in the free version (we show you how to do that for free later).

SilentCMD

NirCMD

Nirsoft’s NirCMD is a small multi function tool that can quietly perform dozens of tasks without popping up any console window. These include ejecting ROM drives, changing audio volumes, enabling screensavers, controlling processes/services and much more. The following command can be used at boot or in a shortcut to run a batch file silently:

The exec and hide commands are used to execute the script and hide any console windows from opening.

Include elevatecmd to request administrator privileges for the batch file although it’s only needed if you know commands in your script require elevation.

A desktop shortcut can be created manually or you can tell NirCMD to create a shortcut from the command line with the included commands so the silent script is ready to run.

$folder.desktop$” “SilentBatch” exec hide C:\Users\Raymondcc\MyBatchFile.bat

The above will create a desktop shortcut called SilentBatch which will silently execute the MyBatchFile.bat script. Note that you may have to change the “Start in” location in the shortcut as output from the script that doesn’t supply a path will default to C:\Windows.

On double clicking the NirCMD executable it will offer the option to copy itself to the Windows directory so you only have to use nircmd.exe and not supply a full path every time. It’s advisable to do that if you plan to make use of NirCMD on your computer (make sure to right click and run nircmd.exe as administrator).

For full information about the wealth of commands available, have a read of the full NirCMD Help file.

Raymond.cc Silent Batch Launcher

We also have a little tool that can launch a batch file silently. It’s created in Autoit and is essentially a slightly advanced version of the “Create Your Own Executable File” method on page two. Silent Batch Launcher is designed to be simple to use and provide a slightly different option to the other tools here.

Run the executable and you will be asked to browse for a batch file. An INI file containing the path to the script will then be created next to the executable. Every time you run Silent Batch Launcher from then on it will execute the same batch file as long as the INI file is present.

To run a different script, delete the INI file or hold Shift while launching the tool and it will popup the file requester. The INI file name will match the EXE file name so you can have differently named occurrences of the tool in the same folder. There are two files in the archive, use the “Admin” version if the script requires elevation. Any useful feedback you have about the tool is welcome.

Читайте также:  Creative sb0230 драйвер windows 10

Note: Because this tool was created with Autoit, it does create some false positives with online virus scanners like VirusTotal.

There are a few other tools that can hide the console window of a batch script that we haven’t mentioned here. They include Cmdow, Create Hidden Process, Hidecon, and Hideexec.

Hide the Batch Console With a Visual Basic Script

Hiding the batch script console window using Visual Basic is quite similar to using an external command and works in basically the same way. Launch the VB script and supply the batch file as an argument, then the code runs the script while not showing any output. It can be done with a single line of code.

CreateObject(“Wscript.Shell”).Run “””” & WScript.Arguments(0) & “”””, 0, False

If you would like to supply an argument for the batch file, the piece of VB script has to be altered slightly by changing the two sets of four double quotes to two sets of two.

CreateObject(“Wscript.Shell”).Run “” & WScript.Arguments(0) & “”, 0, False

Then supply the arguments along with the batch script path inside quotes:

Again, for convenience, you can download a ready made launchquiet_args.vbs script file.

On the next page, we’ll look at how to convert a batch script into an executable file, how to create a batch executable without any additional software and how to run a script from a scheduled task.

Источник

Cmd hide cmd windows

Сообщения: 1014
Благодарности: 194

Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля.

» width=»100%» style=»BORDER-RIGHT: #719bd9 1px solid; BORDER-LEFT: #719bd9 1px solid; BORDER-BOTTOM: #719bd9 1px solid» cellpadding=»6″ cellspacing=»0″ border=»0″>

Сообщения: 1
Благодарности:

Самый простой и четкий способ скрытно запустить батник:

1. Скачиваем hidcon.exe, помещаем его куда угодно (например C:\hidcon.exe)

2. Например нам нужно запустить C:\mybat.bat.

3. Создаем ярлык для C:\hidcon.exe и далее нажимаем на него правой кнопкой, выбираем свойства и во вкладке «ярлык» в строке «объект» прописываем C:\hidcon.exe mybat.bat.

4. Далее кидаем этот ярлык в папку автозагрузка. Вот и все. В результате при запуске винды абсолютно ничего не будет мелькать и не нужно писать никаких дополнительных батников.

P.S. Можно и в назначенные задания его кинуть.

» width=»100%» style=»BORDER-RIGHT: #719bd9 1px solid; BORDER-LEFT: #719bd9 1px solid; BORDER-BOTTOM: #719bd9 1px solid» cellpadding=»6″ cellspacing=»0″ border=»0″>

Сообщения: 140
Благодарности: 92

Можно обойтись и без доп. утилит, например:

скрипт js
;название файла: имя_пользователя.js

var WSHShell = WScript.CreateObject(«WScript.Shell»);
WSHShell.Run(«имя_батника»,0);

прим. батник в той же папке, что и скрипт, если dir-и разные, то путь должен быть вида:
C:\\dir1\\dir2\\filename.bat

Set WshShell = CreateObject(«WScript.Shell»)
WshShell.Run «путь\ имя_батника»,0

или с ожиданием завершения

ну и если батник содержит простой сценарий, то можно и так:

«0» и есть параметр запуска приложения без окна

чтобы его снова увидеть
Set WshShell = CreateObject(«WScript.Shell»)
WshShell.AppActivate(» имя приложения»)

для конкретной задачи:

Set WshShell = CreateObject(«WScript.Shell»)
WshShell.Run «cmd /с DEL /F /Q путь\*.*»,0

Источник

List or delete hidden files from command prompt(CMD)

In Windows, files/folders have a special attribute called hidden attribute. By setting this attribute, we can hide files from being displayed in explorer or command prompt. This article explains how to list this hidden files in windows command line and it also discusses how to delete the hidden files.

To get the list of hidden files from a directory you can run the below command.

Example:

Get the list of hidden files from C:\Windows\system32 folder.

To get the list of hidden files from all sub directories we need to add /S switch to the command.

Example:
To get the list of hidden files from the folder c:\windows\system32 and from all its subfolders we need to run the below command.

List all hidden folders:

If you want to get the list of all hidden subfolders in a folder, you can run the below command.

Hidden files deletion

To delete hidden files from command prompt we can use Del command. For example to delete a hidden file named example.doc we need to run the below command.

Note that /A:H is necessary otherwise you will get ‘file not found’ error like below.

To delete all hidden files from a given directory we can run the below command.

Alternatively you can cd to that directory and then run the below command.

To delete hidden files from subfolders also you can do that by adding /S switch

is it possible to remove a list of hidden folders? for example, i want to remove all hidden folders and their content..

If you want to delete all hidden subfolders from a drive/folder then you first need to generate the list of folders and then delete them. This can be done with the below command.
for /F %i in (‘dir /s /b /A:DH’) do rmdir /s /q %i

Run the above command from the drive or top folder.
Disclaimer: Be cautious while using these commands, as any mistake would lead to data loss. Test and use them at your own risk.

But this command would make the files unhidden. Tayyab’s question was to keep the files marked as hidden but show them in GUI.

Читайте также:  Amd 860k windows 7

Also if you don’t know what hidden files you have in a folder, then also this command does not help.

thank u.. it was helpfull..

you should add more to your blog..ex: how to hide using cmd,how to unlock..etc…by the way your blog is cool keep updating

how to show hidden files /corrupted files using windows commands

Is it possible to delete list of hidden folders with wildcards?

You can using for and dir commands. Use dir command to generate the hidden folders and then for to iterate over the list and then delete. You can refer my answer to Diego above. The only change you would need is to specify the wild card in the dir command. For example, to delete the folders starting with letter ‘a’ then the command would be :
for /F %i in (‘dir /s /b /A:DH a*’) do rmdir /s /q %i

Thanks man, this really helped

Good evening everyone, I got a question…
How do I identify which file is dummy file ; extra files /files which double install or not been used… how can i delete it by CMD. How can i verify is it important to the system or CPU’s files….

I have a program that was installed on a directory that’s no longer available or showing up and I’m trying to reinstall the program but it won’t let me because its still showing or finding it when I run it in the no long existent directory. How do I search for it to remove it?

I got a question. How I can remove a cmd file from my Windows 10 Home for good? It causes a lot of problems such as inability to open all folders by double-click, etc. Thanx.

hi. i really need some help changing or removing my password for my netbook running windows 7. it took me months to replace its LCD and now I can’t remember my password. The guy who switched the LCD do the system restore and mentioned i have to do it since i haven’t opened it for months.. I can’t get pass the lock screen.. I manage to open the cmd and create a new user from the lock screen so that I can go to my desktop. All access are limited since it is created as a standard user.. I can’t install bluestack, my company tools etc. audio is not running and I’m guessing its because I’m not running as an administrator. I tried changing the password but when I look at uusers in cmd, the user kat which is also me is not listed their. So how can I change something that doesn’t exist or even delete it which is on my last option because I still have my files saved their.

An old hack: To reset the passw, find the way *(windows dvd or another installed OS) to open the command prompt at logon (user/pass) screen.
You can do this by rename the original sethc.exe and then make a copy of cmd.exe and name it as sethc.exe. This two files are in C:\Windows\System32. *(are system files and you will need to take the ownership first. Maybe you can use the “unlocker”)
If you successfully done all above, you can now press 5 times the Shift key at logon screen and the command prompt will open. 😉
In the command prompt, you can use the NET USER command and reset the passw.
WARNING! This is not a step by step guide! I just show you a way to do this. (I have done it successfully many times) Be careful with the use of NET USER command!

i need all command line and their uses.
how to configure the switch and port on server system network.

admin please help me I had a problem with my laptop I copied files from another laptop to my hard drive and the files disappeared on my drive. the space that was taken by the file is still occupied please help me get my file back.

I put the hidden folder in a subfolder which was not hidden.
by mistake I deleted the not hidden folder, can I get back the files which is in hidden folder.

If the parent folder is deleted, it would delete all contents hidden/visible. So in this case, you may not be able to get the data back unless you use some advanced tools for recovering deleted files from disk. Should you try them? Depends on how critical the deleted data was for you.

And if you are planning to recover data, it’s advised you do not write any more data to the disk or better stop using the computer till data is recovered.

i have retrieved the folder with password at that moment……later the folder is disapp
eared

Is it possible to delete a non-hidden file from a hidden directory using cmd.
when I use following command
del /A:H “C:\HiddenDirectory\NormalFile.txt”
result is “system cannot find the path specified”

I just want to delete one folder, the C:\$SysReset folder. How do I do that? I find different places on the internet, different ways that it is supposedly done.

I hid a file a while back using command promot but now i cant remember what name i put it under. Is there a way to still find this file?

sir i have forgotten my folder name ….which i had hidden by cmd command …..now any solution to recover the folder

Hello, how would i delete everything on d:\ except a certain folder? There are also 3 hidden folders that will be a different name each time i run this. I cant get rid of the hidden folders any way I have tried writing it. Any help would be greatly appreciated

Источник

Поделиться с друзьями
Советы экспертов и специалистов
Adblock
detector