How to? Windows Key-Left and Windows Key-Right

Apr 18, 2021
2
0
I've got a .btm file to load a number of applications using the START command with the specification of which monitor to use and some of them to be maximized on that particular monitor such as
Code:
START /MONITOR=2 /MAX /PGM "C:\Program Files (x86)\Intuit\QuickBooks 2020\QBW32.EXE"

Included in the .btm, I launch two instances of File Explorer (Windows Explorer before Win10) starting in different drives. I would like to have one launch on the left half of the screen and the other on the right half of the screen similar to how Windows Key-Left and Windows Key_Right work.

Is there some switch to the START, or ACTIVATE or some other command that will do this? Or do I have to use %_xpixels, %_ypixels, do the math to figure out the /POS values needed to give similar effect?
 
May 20, 2008
11,388
99
Syracuse, NY, USA
I doubt you're going to get START or ACTIVATE to do that. I am not aware of any Windows shortcuts that treat the left and right Windows keys differently. How are you using them to get different results?

If you can do what you want with keystrokes, you might use KEYSTACK in your BTM (instead of START or ACTIVATE) ...

KEYSTACK LWin-...

vs.

KEYSTACK RWin-...
 
May 20, 2008
11,388
99
Syracuse, NY, USA
Heehee, I had that back-asswards!
Code:
start explorer.exe & keystack /w54 lwin-left

start explorer.exe & keystack /w54 lwin-right

It took a while but I eventually figured out that those only work if you have window "snapping" enabled. I don't like "snapping" but I had to try it. Those work nicely, Joe. A one second delay (/w18) was sufficient here.
 
  • Like
Reactions: DrNumbers
Apr 18, 2021
2
0
Try these for starters;
Code:
start explorer.exe & keystack /w54 lwin-left

start explorer.exe & keystack /w54 lwin-right

Adjust your wait time accordingly.

Also, maybe the /I option of keystack can provide more accuracy.

Joe

I didn't think of keystack. Other than the timing, that does the trick. I have just found that keystack returns to the prompt (or the batch file moves on to the next statement) before the delay with /w is finished. It does delay the keystroke but the next command in the .btm could be running. I found I had to try the following.
Code:
START /MONITOR=2 /PGM explorer.exe /e,/root,Z:\
DELAY 5
KEYSTACK LWin-Left
DELAY 5
START /MONITOR=2 /PGM explorer.exe /e,/root,Y:\
DELAY 5
KEYSTACK LWin-Right
DELAY 5

I still have to tweak the delay length. Five seconds might be a bit excessive but something needs to let the keystroke occur while the appropriate window is active and not be changed before it occurs. Human delay in typing it in at the command prompt would be sufficient but that's not happening in a batch file.

Thanks for the help.

Heehee, I had that back-asswards!


It took a while but I eventually figured out that those only work if you have window "snapping" enabled. I don't like "snapping" but I had to try it. Those work nicely, Joe. A one second delay (/w18) was sufficient here.

Maybe I wasn't clear enough and should have typed Windows Key-Left Arrow and Windows Key-Right Arrow but then you wouldn't have laughed.

As for the left or right Windows key... I haven't run into anything that makes a differentiation with that particular key but I recall an old MS-DOS pinball game where the shift keys were for the flippers, left shift for the left flipper and right shift for the right flipper. Programatically, it's possible with shift, ctrl, alt, and the Windows key but rarely used.
 
May 20, 2008
11,388
99
Syracuse, NY, USA
If you want to speed things up ... instead of

Code:
START /MONITOR=2 /PGM explorer.exe /e,/root,Z:\
DELAY 5
KEYSTACK LWin-Left

you might try something like this (below). It's the first one I came up with. It works, but here may be more elegant ways to do the same thing.

Code:
START /MONITOR=2 /PGM explorer.exe /e,/root,Z:\
do while not isvisible Z:\ ( delay 1 )
KEYSTACK LWin-Left
 
What about the /I option of KEYSTACK;
Code:
/I Wait for an input idle or the specified number of milliseconds. 

/I=pid,milliseconds                Look for the specified process ID
/I"Title",milliseconds                Look for the specified window title

I have not tried this, but might be useful.

Joe
 
May 20, 2008
11,388
99
Syracuse, NY, USA
What about the /I option of KEYSTACK;
Code:
/I Wait for an input idle or the specified number of milliseconds.

/I=pid,milliseconds                Look for the specified process ID
/I"Title",milliseconds                Look for the specified window title

I have not tried this, but might be useful.

Joe
Any idea how it's supposed to work? This spits out "foo" immediately.

Code:
keystack /I"xxxxxxxx",100000 foo

I don't even know what "Wait for an input idle" means.
 
May 20, 2008
11,388
99
Syracuse, NY, USA
OK, I get it. Thanks, Charles. Either of these works to cause W32TMPARAMETERS.BTM to be selected when the Explorer "v:\" window opens.

Code:
START /PGM explorer.exe /e,/root,v:\ & keystack /I=%_start_pid,10000 "w32tmp"

START /PGM explorer.exe /e,/root,v:\ & keystack /I"v:\",10000 "w32tmp"

So DrNumbers might try something like this:

Code:
START /MONITOR=2 /PGM explorer.exe /e,/root,Z:\
KEYSTACK /I=%_startpid,5000 LWin-Left

or
Code:
START /MONITOR=2 /PGM explorer.exe /e,/root,Z:\
KEYSTACK /I"Z:\",5000 LWin-Left
 
Similar threads
Thread starter Title Forum Replies Date
Stefano Piccardi Why did Windows create an encryption key? Support 5
fpefpe Key Names to toggle between tab windows Support 1
M "Shortcut key" on Windows start menu shortcuts Support 5
J Crash on Windows 10 Support 0
thorntonpg windows 11 Support 9
vefatica Windows 10 themes Support 0
J Take command does not start on Windows 10 Support 3
Joe Caverly PYTHON from Microsoft Windows Store Support 2
D Open Windows 10 Photos app from command line Support 11
vefatica Windows Terminal ... Pop-up location Support 1
Joe Caverly Windows Terminal and @SELECT Support 13
vefatica Console popup windows don't work correctly Support 0
D Layout debugger windows Support 2
L LIST's pop-up search loses focus in a Windows Terminal window Support 15
nickles ANSI Colors Windows 7 no longer working Support 6
S Windows Server version not being detected correctly in TCMD 26RC2 Support 9
D Which is the latest version for Windows XP? Support 2
rconn News Windows 7 Support Support 0
Joe Caverly Windows Size is 80x0 Support 2
rconn Dropping Windows 7 support in Take Command / TCC v26 Support 8
G Taskbar Windows 10 Support 7
T Windows Terminal Support 2
Joe Caverly Windows Sensor Support 5
vefatica Windows 10 and line wrapping selection? Support 6
fishman@panix.com New Problem with later Windows 10 Support 10
CWBillow Upgrade Windows 10's effect on TCMD and TCC Support 3
T Take Command v21 on Windows Server Support 1
Bill de Haan "Sensitive Privilege Use" in Windows security auditing Support 7
Joe Caverly Create Windows Jobs and optionally attach processes to a job Support 17
Joe Caverly What version and Windows OS are you using? Support 3
A Windows 10 This app can't run on your PC Support 2
G 4NT on Windows 10 Support 3
vefatica Undesired scrolling in Windows 10 enhanced console. Support 2
vefatica Windows 10 version number? Support 6
vefatica How do I see Windows 10's ANSI in action? Support 3
A List windows with titles matching given pattern? Support 2
M New "pinned" attribute (since Windows 10 1709) Support 6
Emilio III TCMD Tab titles on Insider Windows Support 2
kb6ojs Want to start TCMD v20 with every Windows 10 bootup Support 3
E Cannot paste dollar sign into TCC on Windows 10 1803 Support 7
M TCC incorrect dir output since Windows 1803 Support 6
G Version 20.11 installed on Windows 10 problems Support 9
fishman@panix.com TCC v22 & the Windows 10 Console Support 5
Per TCC/LE 14 64-bit won't start on Windows 10 Insider Preview 17063 (171213) Support 12
I tcmd versus tcc in Windows 10 Support 2
Dick Johnson DrawBox now broken in Windows 10? Support 6
CWBillow Editing in the root directory of windows 10 Support 6
CWBillow Clearing out the Windows Temp folder Support 2
H New command not working well in Windows 7 Support 4
H _winver shows 6.1 on windows 7 Support 7

Similar threads