Running a batch silently: How to get process ID to show a specific name?
When running a batch file, you may want to hide the command prompt window that appears by default. This can be useful if you want to run a script or a series of commands in the background without any user interaction. In this article, we will discuss how to run a batch file silently and also how to change the process ID (PID) to show a specific name.
Running a batch file silently
By default, when you double-click on a batch file, it opens a command prompt window and displays the output of the commands being executed. However, there are several ways to run a batch file silently:
- Using a VBScript: You can create a VBScript that runs the batch file in the background without displaying any window. Here's an example:
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "C:\path\to\your\batchfile.bat", 0, True
- Using a third-party tool: There are several third-party tools available that allow you to run a batch file silently. One popular tool is NirCmd. You can download and install NirCmd, and then use the following command to run a batch file silently:
nircmd exec hide "C:\path\to\your\batchfile.bat"
- Using Windows Task Scheduler: You can create a scheduled task in Windows Task Scheduler to run the batch file silently. Here's how:
- Open Task Scheduler by searching for it in the Start menu.
- Click on "Create Basic Task" in the Actions pane.
- Follow the wizard to set the desired trigger and action for your task.
- In the "Add arguments" field, specify the path to your batch file.
- Check the "Hidden" option in the "Settings" tab.
- Click "Finish" to create the task.
Changing the process ID (PID) to show a specific name
When you run a batch file, the process ID (PID) of the command prompt window is displayed in the task manager or any other process monitoring tool. By default, the PID is associated with the name of the executable, which is "cmd.exe" for the command prompt window.
However, you can change the process ID (PID) to show a specific name of your choice. This can be useful if you want to make it less obvious that a batch file is running in the background.
To change the process ID (PID) to show a specific name, you can use a tool called "Bat To Exe Converter". This tool allows you to convert a batch file into an executable file with a custom name.
- Download and install "Bat To Exe Converter" from the official website.
- Open the tool and click on "File" > "Open" to select your batch file.
- In the "Exe Format" section, choose the desired options for your executable file.
- In the "Version Information" section, enter the desired name for your process ID (PID).
- Click on "Compile" to convert your batch file into an executable file.
- Run the newly created executable file, and the process ID (PID) will now show the specific name you entered.
By following these steps, you can run a batch file silently and change the process ID (PID) to show a specific name. This can help you perform automated tasks or run scripts in the background without any user interaction.
References
| Source | Link |
|---|---|
| NirCmd | https://www.nirsoft.net/utils/nircmd.html |
| Bat To Exe Converter | https://www.f2ko.de/en/b2e.php |