How do I make a batch file that opens Task Manager? - batch-file

So i have been looking for this on this website and cannot seem to find it so im asking you how to do it

If you are looking to display a list of processes from the command prompt you can use TaskList.exe if you are looking to just open the windows Task Manager you can use TaskMgr.exe
For standard batch file you would just use tasklist.exe. If you were using powershell you would use start-process tasklist.exe -nonewwindow.

I created a batch file to start several programs, including Task Manager. I used this code:
cd C:\ProgramData\Microsoft\Windows\Start Menu\Programs
start taskmgr
if this path does not work for you, right click on the task manager app and look at the path in the "properties"

start taskmgr
should work :)
(tested, it works!)

You can use this with a batch file: start "" TaskMgr.exe
I tried it on Windows 11, it worked fine.

Related

How can I write a batch file to run a specific command?

I'm trying to make a batch file that will run the following command:
control name Microsoft.Personalization page pageWallpaper
How do I do this?
EDIT: I should be more specific. I know how to create a batch file but all I have written in the file is the code above, which just flashes a window and then does nothing.
The following should do what you need:
#echo off
control /name Microsoft.Personalization /page pageWallpaper
The syntax of control.exe requires the slashes before name and page.
Source: Add classic personalization menu in Windows 10 build 10074
Also, Command Line Commands for Control Panel Applets helped lead me to the answer.
I started by googling "windows control.exe command line options".
You know how to create batch files, but if you have any trouble putting the code above into a batch file and running it, and cannot figure out how, please let me know.
This works for me, running:
C:\bin> ver
Microsoft Windows [Version 10.0.14393]
Hope it works for you!
Regards,
Lud nom

Setting user name and password to browser from the Batch file

I have created a batch file to open a browser. But I need to know how to interpret the user name and password from the batch file.
Below is my batch file. Can anyone please help?
FYI, I'm just using the normal .bat file (from notepad).
#ECHO ON
start /d "C:\Program Files\Internet Explorer" IEXPLORE.EXE https://www.myhcl.com/Login/home.aspx
There is no "native" way for a bat file to interact with a window. I would use powershell or VB script for this task but it will be quite a mess.
An easy way is to use AutoIt. It's realy simple and allows you to fully interact with a browser. You could ither use the AutoIt interpreter from within your bat file to manipulate the browser window or just create an au3 or even an exe file that starts the browser and enters the login data.
If you decide to use AutoIt and need help with the script just ask me.

Using a batch file on Desktop to start shortcut on AllUsersDesktop

I use a remote support program to access agent's computers to set them up to work with our dialer.
I use a script via that remote program that adds IE shortcuts to their desktop. To make this script work for any variety of computer setups, the shortcuts are created on the AllUsersDesktop.
I also install a program (called Ventrilo) that creates a shortcut on the specific desktop they are on when I remote into their system.
I would like to add a batch file they can execute that will automatically open the shortcut to Ventrilo and open the IE shortcut on the AllUsersDesktop.
The batch file I have is as follows:
#echo off
start Ventrilo.lnk
start Shortcut.lnk
This opens Ventrilo but not the Shortcut. I am certain it is because the Shortcut is on the AllUsersDesktop, while the shortcut to Ventrilo is not. However, I cannot figure out how to use that start command in conjunction with %AllUserDesktop%
%allusersprofile%\desktop\shortcut.lnk
Type set in a command prompt.
You can start IE by calling start on iexplore, no need to run the shortcut.
start iexplore
Alternatively GoughW's answer should do the trick to.
Make sure you have an end line at the end of your
start shortcut.lnk
in your batch file.

How to write a batch file to run applications opening in different command prompts?

I would like to run three servers on my Windows machine from command prompt. For this I would like to write a batch file to run these opening three different command prompts.
To generate 3 new CMD windows that remain open, use the following command syntax:
start "application1" cmd.exe /k dir *.exe
start "application2" cmd.exe /k dir *.xml
start "application3" cmd.exe /k dir *.bat
Where the command after /k is whatever application command line that you want to launch.
Replace the "application#" with some TITLE for the window, that makes sense for you (otherwise it will just say something like C:\Windows\System32\CMD.exe).
The windows will stay open, but that doesn't mean your application will still be running. Like the Dir examples above, it may end but the window will remain.
The full command syntax for START is found here.
The full command syntax for CMD is found here.
Why batch?
If you can, my best suggestion would be to ditch batch and download cygwin in order to use bash instead.
You will find bash much more flexible, used (which means you are far more likely to get support from others), and supported.
I am a windows user and tried to learn batch some time ago, but it was really really frustrating. bash is so much more user friendly.
This should do what you want
start application1
start application2
start application3
This will start 3 applications which will open with 3 different command prompts, whether or not they will keep running or not will depend on the app.

run bat file in background

I want to run a bat file in background. I searched in google and I found some examples using hstart and cmdow. But Isn't anyway to do this with windows commands? I really feal good when I don't add extra programs to my project !
thanx in advance
I'm using window scheduler. I found a way :
Save this one line of text as file invisible.vbs:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
To run any program or batch file invisibly, use it like this:
wscript.exe "C:\Wherever\invisible.vbs" "C:\Some Other Place\MyBatchFile.bat"
thanx
It really depends on the programming language and platform you are using.
In Windows, using the C# language on the .NET platform, it is:
System.Diagnostics.Process.Start(#"C:\myfile.bat");
You can try to run the batch file as a windows service. You will perhaps need to have admin previleges on your host to do this, but if you want to go for it, its easy to add/configure using sc command.

Resources