Press enter to close a window in Batch - windows

I'm playing a game and alongside the game .exe I also run another .exe that runs a personal program I'm developing (it records information that I can then monitor outside the game.)
One of the .exe's opens a cmd window, which I'd then like to immediately close at the end of the .bat.
Pressing enter manually will close the window, however, I don't know how to automate the enter keypress.
All I want to do is automate the pressing of the enter key after both the exes have been launched.
Should be simple to do I guess! but looked around for a while and can't find a solution.
Thanks.
the code for my very very basic batch:
start "" "E:\World of Warcraft\Wow-64.exe"
start "" "C:\Users\Kek\Desktop\New folder\DocumentAll.exe"

Related

How can I run and close an exe file with a mouse key?

I have an exe file and I want to run it and close it by pressing a mouse button or a keyboard button. For eg. say it is a music.exe and I want to open it while I am gaming/doing spread sheet by pressing the key 'm' or mouse button.
I have access to a logitech macro supported mouse. Also a no macro generic microsoft mouse. I am thinking about some kind of macro , or tasker or some script that can do this easily. ( not that I dont want to directly click the exe file or close the exe file by clicking x on the window)
Any suggestion would be helpful ;)
I did it with AutoHotKey software. If anyone is interested , here is the code
XButton2:: if WinExist("WindowName") WinClose ; else Run *runas "%directory%\Music.exe" return
This code will run and close the Music app with admin previlages. ( Change "Run *runas" to "run" if you want it to run normally)

Explorer not starting after logon script ran

I set a batch script to run at logon using GPO that runs an exe. The exe runs, but Explorer doesn't start until after I stop the exe
For example, say this is my batch file:
notepad.exe
This will open notepad on a black background; no task bar, no desktop. When I close notepad, the task bar and desktop icons come up. If I change the batch file to this:
notepad.exe
explorer
at logon, notepad opens up and the task bar and desktop icons appear.
I've checked GPO settings to make sure logon scripts are being run asynchronously so I'm not sure what's going on. Can anyone help me with this?
For clarification, I'm not trying to run notepad at startup, I'm trying to run a synchronization program that doesn't have a UI so when I start it using the batch script, I just get a black screen because I guess the logon process is waiting for the exe to 'finish' or close to start explorer.
Try
start "" notepad.exe
You can place a window-title between the " if you like.

Windows batch start up script to move windows

I'm experienced with many different programming languages. I decided to expand my horizons and try some simple batch scripts. I have a windows start up script that I'm running.
startupScript.bat
start "" "explorer.exe"
start "" "explorer.exe"
start "" "taskmgr.exe"
start "" "cmd.exe"
start "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Works great. I would like to be able to move the windows where I want them though. I'm running 5 monitors, and I want the two explorer windows on my bottom left monitor each taking half the screen. I want the command prompt and task manager in my top left monitor each taking half of the screen, and I want my chrome browser on my bottom right monitor taking up the whole screen.
Chrome remembers where it was, so that isn't a problem. The other windows don't though.
Is there a way for me to run keystrokes after each program is started? I could do "winkey+left", "winkey+left", etc... for each window if that's possible. Otherwise how might I accomplish this?
Also, when the command line is run, the properties go to defaults. Is there a way to use my command line settings so that it is sized right, has quick edit mode enabled, and has the colors that I set it to?
I'd try setting up a shortcut to the application with shortcut/Run=normal window; layout and hues to taste. Then start the shortcut (.lnk file) in your batch. Certainly works for cmd - can't say for the others...
I would have a look at AutoHotKey. I don't remember enough to tell you what your script should look like, but the little I remember tells me all you need is in their toolbox.

I want to prevent a window from opening when an application launches

I have a program the opens a window, reads a config file, then closes the window a fraction of a second later, then continues running in background. I want to be able to start this program one way or another without the window appearing in the first place.
Is there a way for me to launch the program (preferably on PC startup) but suppress any windows it creates?
I do not have the source code for the program in question. In that regard I am an end-user.
use a vbs script to open it:
set obj = createobject("wscript.shell")
obj.run "prog.exe",0,false
call that prog.vbs or whatever, and put it in:
"%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\startup"

how to detect programmatically when a powerpoint slideshow starts

I would like to write a windows program that would enable the user to choose a ppt file. When that ppt file starts the slideshow, my program would automatically display some message in front of the slideshow. When the slideshow is over, my program would close itself. What do I need to learn to write this program?
I'm not good with VBS (which I'm sure you could use for this) but if you set your show's extensions to .PPS instead of .PPT that will force them to start playing automatically on open. Then you won't need to see when the show starts because you'll control that.
As for opening it, if you write BATCH script you can use it to prompt for a file location but it will all be manually typed because it will load from the command window. If a show opens, the command screen can stay open until that slideshow closes, then continue with the next line of script.
Depending on if these are your powerpoints that you want opened, I personally would put VBA script in them to trigger On_Open and On_Close That will get you a clean customizable popup error message.
Edit
After doing some quick searching the On_Open and On_Close is not found in PPT, you would need to install an add-in.

Resources