start conemu with multiple tabs - conemu

I have 5 different generators.
I've created 5 different tasks in conemu to start a new tab with the name of the generator on the tab and the generator starts immediately.
Now I need to create a script that when conemu doesn't run. ConEmu starts with immediately the 5 tasks started in each there own tab.
How can I start conemu from the command line to start automatically the 5 tasks?
Layout of tasks:
10 {generators::generator1}
11 {generators::generator2}
12 {generators::generator3}
13 {generators::generator4}
14 {generators::generator5}
Code example in task:
%comspec% /k RenameTab "generator one" & "c:\generators\bin\startgen" one
And then I like to start it like:
ConEmu -tasks 10 11 12 13 14
or
ConEmu -tasks generators::generator1 generators::generator2 generators::generator3 generators::generator4 generators::generator5
Is this possible in any way?

I've just found it myself, here
It works with a startup file and putting the commands inside that file.
That doesn't start the tasks, but it can work for me.
If someone has a method to start the tasks directly it will help ofcourse.

Related

conemu - how to 'group input' in a task?

I have created a task in conemu which launches 3 consoles and ssh to 3 different servers. I would like to also 'group inputs' directly when launching this new task.
Right now, I need to press Apps+G once the 3 consoles are up in order to be able to run the same command in all three consoles.
Is there a way to get Apps+G to be called when launching the task without I having to do it ?
Supposing you start three cmd.exe consoles. First one would be active. Last line executes GuiMacro and immediately terminates.
>cmd.exe /k "%ConEmuBaseDir%\CmdInit.cmd"
cmd.exe /k "%ConEmuBaseDir%\CmdInit.cmd"
cmd.exe /k "%ConEmuBaseDir%\CmdInit.cmd"
cmd /c -cur_console:n ConEmuC -GuiMacro GroupInput 4

"more" command will not save to file

I am trying to delete the first 200 lines in a .txt file.
The above code has been working for months but just recently has stopped working, the code runs up to the more command then stops.
If I press the keyboard a few times it will trigger something and start moving on to the next lines of code.
I want this code to run without me manually pressing the keyboard a few times while running.
As a side note if I close the terminal window instead of forcing the script along and then try to delete the new database2.txt file, I get an error that the file cannot be deleted because it is in use by more.com.
My code:
cd c:\folder
more /E +200 Database.txt > Database2.txt
timeout 10
del /f Database.txt
timeout 10
rename Database2.txt Database.txt
timeout 10
exit;
I am running:
Windows 10 home version 1703
OS build: 15063.674
Ram: 6gb
X64 processor
64bit OS
Intel core i5-2430m cpu#2.40ghz
Any help is appreciated!!
I appreciate everyone's help in trying to figure out my problem but I have found the solution. I formatted the comand in this way:
">Database2.txt (
More +200 Database.txt
)"
If someone could shed some light as to why this happened or how this format has fixed my problem when it is supposed to be the same command that would be great!

Writing script in windows to run two command line in 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

What could be the reason why a batch command periodically hangs?

Good day! There are quite a few batch commands that are used to trigger events on three servers we have. I'm not really familiar with batch commands, but I have written a few. My problem is, I wrote a very simple batch command that calls and runs an .EXE file that automatically applies batches on a POS Server. Here is the command;
C:\grocery\sm2baply.exe /a
This has been working fine for weeks, but lately it just hangs until the next schedule task is ran with the same command and it overrides this. But the batches that should have been applied were not. About 3 out of 7 days it doesn't work.
Can someone help me please?
Thanks.
Schedule Tasks keep a log of what happened. So read the log.
In Scheduled Tasks select your task. History tab. EG one of mine failed with this.
- System
- Provider
[ Name] Microsoft-Windows-TaskScheduler
[ Guid] {de7b24ea-73c8-4a09-985d-5bdadcfa9017}
EventID 202
Version 0
Level 2
Task 202
Opcode 102
Keywords 0x8000000000000000
- TimeCreated
[ SystemTime] 2014-07-27T21:00:04.786Z
EventRecordID 2008255
- Correlation
[ ActivityID] {99694429-2673-4F4F-92E2-F55EDB9A20AC}
- Execution
[ ProcessID] 1700
[ ThreadID] 3140
Channel Microsoft-Windows-TaskScheduler/Operational
Computer Serenity
- Security
[ UserID] S-1-5-21-2820837959-2753176274-143444667-1000
- EventData
TaskName \Alarm2
TaskInstanceId {99694429-2673-4F4F-92E2-F55EDB9A20AC}
ActionName Hi
ResultCode 2147746317
2147746317 = 0x8004020d which is
//
// MessageId: EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT
//
// MessageText:
//
// Cannot modify or delete an object that was not added using the COM+ Admin SDK
//
#define EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT _HRESULT_TYPEDEF_(0x8004020DL)
If that doesn't work you need to monitor your batch. Echoing out things during execution (in case it's hanging). EG
Copy somefile.ext someotherfile.ext
echo Up to copy >> program.log
You can also start in a debugger.
windbg or ntsd (ntsd is a console program and maybe installed). Both are also from Debugging Tools For Windows.
Download and install Debugging Tools for Windows
http://msdn.microsoft.com/en-us/windows/hardware/hh852363
Install the Windows SDK but just choose the debugging tools.
Create a folder called Symbols in C:\
Start Windbg. File menu - Symbol File Path and enter
srv*C:\symbols*http://msdl.microsoft.com/download/symbols
then
windbg -o -g -G c:\windows\system32\cmd.exe /k batfile.bat
You can press F12 to stop it and kb will show the call stack (g continues the program). If there's errors it will also stop and show them.

Creating a batch file that runs 4 times a day and execute 14 batch files from different folders?

How to create a batch file that runs 4 times a day and execute 14 batch files from different folders? whose logs are directed to that 14 folders itself as per the batch file format and moving logs from those 14 folders to a common place?
To point you in the right direction:
Use start to start each of the 14 batch files
Use task scheduler (schtasks from cmd) to schedule it 4 times a day
Use > to redirect stdout for logging
Use copy to copy the logs to a common place

Resources