I have created two independent batch files. Both open web browsers. One opens Firefox and the other Opens Edge. Both batches are opening multiple tabs in their respective applications. How do I write a batch to pass through the Control + Tab keys in batch at the end of my file to go back to the first tab?
Can this be done with Edge and Firefox? Can they be written the same way?
I don't need the tabs to refresh upon the switch.
I've tried this for Edge,
#echo off
start microsoft-edge:"https://stackoverflow.com"
start microsoft-edge:"https://google.com"
timeout 2
$wshell=New-Object -ComObject wscript.shell;
$wshell.AppActivate('microsoft-edge'); # Activate on EDGE browser
$wshell.SendKeys('^+{TAB}'); # CONTROL+SHIFT+TAB
..to no prevail. Yes, the batch starts and opens Edge and applies the two addresses to two tabs but I can not figure out how to SendKeys to the application.
Any Tips or Pointers will be greatly appreciated. Thanks in advance.
I've tried many ways to send keys combination but the combination of ^+{TAB} seems always not work. I find a software called AutoHotkey which can achieve your goal.
You can first download the software and create a autohotkey script file named test.ahk, with following content:
send ^{TAB}
exit
Then run the test.ahk in bat file:
#echo off
start microsoft-edge:"https://stackoverflow.com"
start microsoft-edge:"https://google.com"
timeout 2
$wshell=New-Object -ComObject wscript.shell;
$wshell.AppActivate('microsoft-edge');
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "C:\Users\username\Desktop\test.ahk"
Please notice to replace the path with your own path. I've tested it and this could be a workaround.
Related
at the moment im trying to open a pdf file %UserInputID%.pdf in fullscreen but i dont quite get it to work.
At the moment im just doing start "" /max "path\%UserInputID%.pdf".
I did find out about outdated workarounds with powershell that use SendKeys but as that is not completly supported anymore (?) i thought about using the startparameter of edge/chromium. But how? How to use --start-fullscreen as a parameter? Just appending it like -parameter \%UserInputID%.pdf" ---start-fullscreen does not work, neither does /parameter \%UserInputID%.pdf" /--start-fullscreen. Happy for every answer or hint.
*Edge is the standard pdf programm
*Edit / Addendum: After KJ's Answer I also figured
start "name" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --start-fullscreen file:///"path\%UserInputID%.pdf"
as a (partial) valid answer. Partial because if only a single (partial) instance of edge is still open (normal x doesnt do the job) it wont work, as it seem like it cant "start" in fullscreen if it is already open in non fullscreen mode.
There are in your case two ways to use MSEdge
The first as you know is if it is the default pdf application then it will use current edge profile to open the pdf so as you describe we can simply use
start "" /max "mydemo.pdf"
And Edge will use its default settings to display MyDemo.PDF in a window but will ignore the /MAX request.
It is the same if we call it directly
start "" /max msedge "file:///C:\mypath\mydemo.pdf"
However we can use it in Kiosk mode
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --kiosk --no-first-run --edge-kiosk-type=fullscreen file:///C:\mypath\mydemo.pdf
if you wish you can also add a minute timer for auto release to normal mode but it is minutes not seconds
--kiosk-idle-timeout-minutes=1
as comment added to question you can also run the second session as
start "" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --start-fullscreen --no-first-run --edge-kiosk-type=fullscreen file:///C:\mypath\mydemo.pdf
I am looking for a way to create a Powershell script that will allow me to open DB Browser for SQLite ("C:\Program Files\DB Browser for SQLite\DB Browser for SQLite.exe") and upon opening, load a file (C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db) in order for me to edit. Any help would be great (if possible).
Please see the documentation: https://github.com/sqlitebrowser/sqlitebrowser/wiki/Command-Line-Interface#examples
According to that, it should be:
"C:\Program Files\DB Browser for SQLite\sqlitebrowser" "C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db"
#ChristianBaumann is OK, and it will work from command prompt. But for powershell this will fail. You need to use & to run it:
& "C:\Program Files\DB Browser for SQLite\sqlitebrowser.exe" "C:\Users\XXXXX\AppData\Roaming\AirHauler2XP\Company\Atlas Airlines25045 PM.db"
I would add it to the path one way or another.
$env:path += ';C:\Program Files\DB Browser for SQLite'
cd AppData\Roaming\AirHauler2XP\Company
sqlitebrowser '.\Atlas Airlines25045 PM.db' # tab completion on the filename
I don't know if that's possible.
I managed to have conemu open two tabs (with a custom name) on startup and cd inside the folders i needs, now my question is:
Is there any way to make conemu open two different tabs in two different windows and position them top-right-corner and bottom-right-corner?
The task i run on startup is the following:
title Website & cmd /k "%ConEmuDir%..\init.bat" && cd c:\src\www
title Other& cmd /k "%ConEmuDir%..\init.bat" && cd c:\src\other
Thanks
As always, read the documentation.
Use -new_console to open a separate window, play with tabs normally. Documentation.
If you’re lucky, the author of ConEmu will notice you and help you out better than I can.
I need to open 2 Edge windows from a batch file (not two tabs, 2 windows). I know I can launch edge using the following command:
start microsoft-edge:
But if I try it twice the second command does nothing. If I try it with URLs I get 2 tabs in the same window. e.g.
start microsoft-edge:http://google.com
start microsoft-edge:http://bing.com
Any ideas how to get 2 separate windows?
Use --new-window option:
start msedge http://google.com
start msedge --new-window http://bing.com
As you are aware, you can trigger Microsoft Edge indirectly from the command line (or a batch file) by using the microsoft-edge: protocol handler. Unfortunately, this approach doesn't enable you to open up an arbitrary number of windows.
The Microsoft Edge team built a small utility to assist, and presently hosts it on GitHub.
> MicrosoftEdgeLauncher.exe http://bing.com
> MicrosoftEdgeLauncher.exe http://stackoverflow.com
I just tested this, and it opened two individual windows for me. There does appear to be an issue where the second window doesn't navigate to the URL; remaining open with the New Tab Page.
You can open as many as you like, just create batch files that call other batch files.
Very easy to do.
Ex: batch1.cmd:
#echo off
start microsoft-edge:http://google.com
start "path\batch2.cmd"
exit
Make sure to add "start microsoft-edge:http://bing.com" on your "batch2.cmd" file
Manny
You can use the executable msedge_proxy.exe which is installed alongside msedge.exe. For example in "C:\Program Files (x86)\Microsoft\Edge\Application".
Sample usage:
> msedge_proxy.exe --app=http://bing.com
If you execute that command multiple times, it pops a new window each time.
I have got a batch script that ends with the following:
TITLE ALL DONE. You can close this window
ECHO.
ECHO ALL DONE. You can close this window
ECHO.
Pause
EXIT
it works fine when i run just the bat file (see below)
All Done! You can close this window.
Press any key to continue . . .
But when i create a self extracting exe out of the same bat script it wouldn't show this window after the execution and would just exit without any proper message.
Since the script works fine by itself, i am a bit lost on what could be causing this? How could i make the self extracting exe to show that window and prompt the user to close it like above.
It depends on the content of the executable, if your including other files to your archive be sure the program you run after extraction is your batch file.
If your only including that file i suggest you use BatToExe Converter
much more efficient way to build it, also it supports commandline, including other files, product info, admin manifest etc