Writing script in windows to run two command line in ConEmu - conemu

I was wondering if I can write some kind of script for ConEmu so that I can start two command lines with some parameter. Here what I am trying to do:
$ start app1 someParam //start in one cmd line tab
$ start app2 otherParam //start in second cmd line tab
Any direction is appreciated.

Direction? Docs of course. LaunchNewTab, CommandLine, -new_console, Tasks. Numerous methods for any case.
Actually, you question is not clear. What do you want to run and where? The docs show several examples how to run several tabs at once. For example:
ConEmu -cmdlist app1 someParam ||| app2 otherParam

Related

how to switch browser tabs using batch

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.

conemu - on startup open two windows and position them like i want

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.

Open multiple Microsoft Edge windows from batch file

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.

Move ConEmu prompt to new line following path?

ConEmu by default has a prompt which is like "${cwdfull}>" I'd like instead, "${cwdfull}\n> ". How do I customize this? I see it must be possible since cmdr which is based on ConEmu has it.
Thanks in advance!
ConEmu by default
conemu -basic -cmd {cmd}
has following prompt
You can easily check how it is created in Tasks and %ConEmuBaseDir%\CmdInit.cmd batch file. All "magic" is done by PROMPT variable. For example set PROMPT=$P$_$G.
Update
I really do not understand your question from the comment below. Default ConEmu task {cmd (Admin)} has the same prompt and its configuration is done by absolutely the same way.

Can't fire script with CFThread, CFExecute and Plink

I am needing to run a remote script on our network to import files. I have set up plink and have it working as needed if I run it manually.
plink name#localserver -ssh -i myKey.ppk /home/here/scriptName.sh
We are writing the code in ColdFusion so this will run in a CFThread using CFExecute.
The cfexecute does not error when I run it via the code it just not fire the script.
In my research I have found people saying that cfexecute has some issues with the argument string and a better idea is creating a batch file and using cfexecute to run the batch file.
so I have created a batch file.
import.bat
C:\inetpub\wwwroot\myapp\plink\plink.exe name#localserver -ssh -i myKey.ppk /home/here/scriptName.sh)
again if I run the the batch file manually it works.
import.bat
but if I run it via cfexecute it does nothing.
To test cfexecute I have it running two commands, the first what I need to work and the second a test. the second works as needed. the first one is not erroring to screen or log file. It did if I entered bad syntax. The second is writing to file as needed.
(code below)
starting
<cfoutput>
<cfexecute name = "C:\inetpub\wwwroot\myapp\plink\import.bat" errorfile="C:\inetpub\wwwroot\myapp\logs\#timeformat( now(),"HHMMSS") #.log" ></cfexecute>
<cfexecute name = "C:\WinNT\System32\netstat.exe"
arguments = "-e"
outputFile = "C:\Temp\#timeformat( now(),"HHMMSS") #.txt"
timeout = "1">
</cfexecute>
</cfoutput>
the end
<cfabort>
any thoughts would be greatly appreciated...
Thanks,
Brian
Try
<cfexecute name="c:\winNt\system32\cmd.exe"
arguments="/c C:\inetpub\wwwroot\myapp\plink\import.bat" timeout="100">
</cfexecute>

Resources