Explorer not starting after logon script ran - windows

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.

Related

C:\windows\SysWow64\CScript.exe window pop up

I created a macro in Excel and i am running it from a .vbs file. It's working fine on my laptop. I copied the same work on a new laptop and each time i am running the vbs file this window appears on the screen.
I have made some research and read that the situation i mentioned is happening when loading CheckNDISPort service on the startup. But i don't believe it's the reason because when i go to task manager and check in the startUp tab i don't find this service. Also when i restart my laptop i don't get this window, only when i am running my vbs file. I am sure there is any problem with my vbs file too because on the other laptops it's working fine.
Any suggestion please how to get ride of this pop up ? For now i am closing the window each time or ending the task from task manager but everytime i run it again so it pops up again.
Thank you very much.
Windows Scripting Host has two interpreter front-ends, wscript.exe and cscript.exe. cscript.exe is a console application and if cscript.exe is set as the default a console window will open every time you execute a script.
Run cmd.exe elevated as administrator and run wscript.exe //h:wscript.
Depending on the Windows version, you might also be able to right-click a .vbs file, select "Open with...", choose %windir%\system32\wscript.exe and check the "default" checkbox.

Press enter to close a window in Batch

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"

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 close Windows Explorer from CMD

Is it possible to close Windows Explorer from CMD? I have a batch that does this: it will change directory, open explorer in this folder, than run a program. After the user closes the program the batch should close the explorer (or all explorers opened), continue on next folder (cd folder), run the same program in this folder and so on. Till the last folder is processed.
Close the explorer windows by killing the explorer process (note that this may do more than just kill the windows, but it will definitely do that):
for example, use win+r and try this
cmd /c "taskkill /f /im explorer.exe && start explorer"
If you kill explorer without restarting it, use Ctrl+shift+Esc to pull up the taskmanager and start a new task "explorer".
Not from a batch file unless you want to write your own command line application that opens up a windows explorer window, and (this is the key part) somehow knows the window handle of that explorer window, so it can post a WM_CLOSE message to it, which basically simulates someone closing that window.
How you would determine "all the explorer windows that got opened" would be that instead of just starting explorer.exe instances from a command line you would do it from your own application.
I think that determining the window handle (HWND in win32 api terms) and posting a close message would be better than trying to track process handles and terminating explorer process instances, since that could cause some side effects beyond those that you'd want.

Full screen through batch command?

I have a batch script under Windows. When anyone will click on that script I want the command window to become full screen like we do by keyboard shortcut [Alt+Enter].
Can it be done automatically using any command in batch file?
In Windows XP, you need to start your program maximized (but not full screen) via "start /max" as follows:
start "Winow Title" /MAX "C:\batches\myfile.bat"
This command would be inside your original batch file, and call the real bath file.
I don't think there's a way to change the full screen-ness of an executing "cmd" command from within a batch file absent someone writing a special app to do so by emulating sending Alt+Enter to the parent process.
In Windows 7 (and probably Vista) you must run inside XP virtual machine for full screen mode.
There is none. You can write a small program doing so for you, though. There is the SetConsoleDisplayMode function.

Resources