Windows batch start up script to move windows - 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.

Related

Can I have multiple Powershell Consoles in one window?

So, now I have many open apps, often 3-4 powershell consoles. I'm able to order the powershell windows to watch them together (top left, top right, bottom left, bottom right).
So this means that if I switch to another app, when I switch back I have to restore all multiple powershell windows to see them all again.
What I want is, to create only one 'shared window' for many powershell, because when I need one, I need all of them to see.
Is there a way to do this?
Just to add more details about Windows Terminal approach:
Open a Windows Terminal
Type Alt+Shift+= or Alt+Shift+- to open a new Pane in the same tab
Type Shift+Ctrl+W to close the current Pane
If you need more details or modify the settings, go to next page Panes in Windows Terminal
ConEmu has this option.
You can also configure it to open as much consoles as you want when it starts.
ConEmu website
Enjoy!
VSCode can have Multiple Terminals which is the closest to this I've seen, quoted from documentaion:
You can create multiple terminals open to different locations and easily navigate between them. Terminal instances can be added by hitting the plus icon on the top-right of the TERMINAL panel or by triggering the Ctrl+Shift+` command. This creates another entry in the dropdown list that can be used to switch between them.
You can also split the terminal by triggering the Ctrl+\ command or via the right click context menu
Windows now provides the Windows Terminal.
Windows Terminal can split the terminal into panes and can also run different shells (i.e. cmd, powershell, and bash through the wsl)
You can install Windows Terminal directly from the Windows Store.
Create a virtual machine where you can run your PowerShell sessions uninterrupted. The PowerShell windows are always where I placed them when I come back.
It could be an expensive solution depending on your needs, but I have been doing this a long time. It's a robust solution since the only user processes on the VM are my PowerShell sessions.

Compiled batch file run fullscreen

I have a batchfiles which basicly just "echo"s text into the cmd window. I compiled it to an exe but want it to be in full screen without borders and without taskbar.(Windows 7)
It should work without having to create a shortcut or any other settings like this.
It can be in the Batch code or the exe but it should start in fullscreen when - for example - I download and execute it on another computer without me having to set any settings.
Is that even possible in Batch?
If you mean running cmd.exe in fullscreen in Windows 7, it's basically impossible. Lots of people were complaining about it.
There are plenty "fake" fullscreen command lines.
You can use this one and run the batch there.

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.

Automatically Position Application Window Using Command File in Windows

I'm using PuTTY to access my BSD file server and I have several terminal windows open at once. I wrote a simple command file to automate opening the terminal windows and I'd like to know if it is possible to place them at a specific location.
I have two monitors and as it is now, I have to manually drag the terminal windows over to my second monitor.
AFAIK you can't do it directly from a batch file without using some 3rd party software like AutoHotkey.
It makes it incredibly easy to move a window. For example this script would start Calculator and move it to the top-left corner:
Run, calc.exe
WinWait, Calculator
WinMove, 0, 0
You can also easily compile your script into an .exe if you want to share it with other people that don't have AHK installed. It will basically answer all your automation needs, just as it has done mine :)

Minimizing or closing a program with batch script

I am writing a batch script intended for handling some tasks in my (and a few colleagues) windows startup. The main thing that needs to happen is the killing of a few processes that do to this being a large corporate environment are started as default. They interfere with our work so we have to kill them... I know it's stupid but thats beside the point. This is can not be changed and we have to make due.
I thought about adding some more useful functionality to the script, like starting up certain programs and so on. This all works decently well but the problem i have is that the OUClient won't start minimized. It doesn't open a window (so it is minimized to some extent) but it still appears in the alt-tab list, witch it doesn't when i minimize or close it manually. This is the script:
#echo off
C:
cd "C:\Program Files\SysInternals\"
pskill flxps12.exe
pskill flxps17.exe
start /minimized "" "C:\Program Files\Osiris Data\OUClient\OUClient.exe"
start "Outlook" "C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE"
start "Explorer" "C:\Program Files\Internet Explorer\iexplore.exe"
cls
#exit
So the question is: How can I make the OUClient minimize, or even better close to the system tray (like if you clicked the red x in the upper right) after it is started.
We are running this on Windows XP SP2.
EDIT: Everything works fine except the /minimize on OUClient.
There is no way to do this from batch files directly, but you can write a little helper program which finds a window and then uses ShowWindow to minimize it. Unfortunately this doesn't seem to be easily available from VBScript which would have made this a little easier.
The minimized switch has a forward slash, not a backslash.
I don't know if OUClient will respect that, but it should.
Have you had a look at the TASKKILL command? A basic example would be
TASKKILL /IM /F iexplore.exe
(yes, who wouldn't want to kill iexplore? ;-))
Best.

Resources