Move ConEmu prompt to new line following path? - conemu

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.

Related

How can use sendKey method in bat file?

first of all, I knew this question is duplicated but I'm new to bat file and I don't know how to develop this structure.
I want a bat file that works with windows task schedule at a specific time automatically.
I manually use this command in cmd
php\php.exe -f processmaker workspace-backup workflow
then I press enter in cmd to run this command
after that
I manually use this command in cmd
SET PATH=C:\Program Files\MySQL\MySQL server 5.6\bin
then I press enter in cmd again...
ok I want a solution to pressing "ENTER KEY" automatically between these commands.
Can you please help me?
If you edit a text file and name it, say mytask.bat
All the lines in it are executed as if in the command line, so try it, it should work.

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.

Command runs in commandline but not through BAT file

I am running the following command in cmd for which I am able to get the log successfully.
cd C:\Users\sriram\AppData\Local\Temp\license1.1.4
C:\Users\sriram\AppData\Local\Temp\license1.1.4>lsmon.exe testprovilic.muc.company> C:\Users\sriram\AppData\Local\Temp\license1.1.4\usage.log
Above command will generate the logs in the usage log file. But I created a batch file as below for which it is giving me an error testprovilic.muc.company not found
#ECHO off
SET variable=C:\Users\s.d.vaidyanathan\AppData\Local\Temp\usage.log
START "C:\Users\s.d.vaidyanathan\AppData\Local\Temp\license1.1.4"lsmon.exe testprovilic.muc.company> "%variable%"
Could you please help me solve this issue.
Thanks and Regards,
Sriram
You need to add the "cd C:\Users\sriram\AppData\Local\Temp\license1.1.4" to the batch file. Or use the full path to the file like:
C:\Users\sriram\AppData\Local\Temp\license1.1.4\testprovilic.muc.company
So you would have ..
#ECHO off
cd C:\Users\sriram\AppData\Local\Temp\license1.1.4
SET variable=C:\Users\s.d.vaidyanathan\AppData\Local\Temp\usage.log
START "C:\Users\s.d.vaidyanathan\AppData\Local\Temp\license1.1.4"lsmon.exe testprovilic.muc.company> "%variable%"
or you could
#ECHO off
SET variable=C:\Users\s.d.vaidyanathan\AppData\Local\Temp\usage.log
START "C:\Users\s.d.vaidyanathan\AppData\Local\Temp\license1.1.4"lsmon.exe C:\Users\sriram\AppData\Local\Temp\license1.1.4\testprovilic.muc.company> "%variable%"
This doesn't work:
"C:\Users\s.d.vaidyanathan\AppData\Local\Temp\license1.1.4"lsmon.exe
The whole path needs to be in quotes and there needs to be a backslash after the last folder name.
Change it to this:
"C:\Users\s.d.vaidyanathan\AppData\Local\Temp\license1.1.4\lsmon.exe"
Open a command prompt window, type set and press key RETURN or ENTER to run this command. You get displayed all predefined environment variables with their current values. You can see TEMP, USERPROFILE and USERNAME.
Windows command line has a help. The command to get help is help, yes really. Try it out! You need help on command CD, enter in command prompt window help cd or alternatively cd /?. You need help on command SET and START, run help set or set /? and help start or start /?. All internal commands of cmd.exe and nearly all console applications support the parameter /? and output 1 or more help pages on running the command with this parameter.
You need a better overview of standard Windows commands? See Microsoft's command-line reference and SS64's command line reference.
I assume that sriram is your user account and s.d.vaidyanathan is the user account of someone else. By default a standard user has no permissions to access folders and files in a different user's profile than the own profile since Windows Vista. That means, you logged in as sriram can't access the files and folders of C:\Users\s.d.vaidyanathan because of missing permissions to do so. It would be necessary to use command Runas to run the batch file with account s.d.vaidyanathan.
#echo off
rem Execute lsmon.exe from license1.1.4 in my folder for temporary
rem files and folders and write the log file also into this folder.
"%TEMP%\license1.1.4\lsmon.exe" testprovilic.muc.company >"%TEMP%\license1.1.4\usage.log"
Note: Double quotes must be used around path AND file name. Just double quoting parts of a file name with path may or may not work depending on error correction and how the application is written. For details see answer on set environment variables with spaces.
See also the Microsoft article Using command redirection operators.
And regarding right usage of command START not really needed here see for example answer on How to call a batch file in the parent folder of current batch file?

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

Run batch file in the background

I have a batch file, this batch file will not start automatically, it will only run when i double click on it.
Can I run the batch file in the background when I double click on it.
Well, you can start it minimized with start, if that is enough. Really hiding it is difficult (although I can think of an option right now).
Basically you need to determine whether the batch has been started by double-clicking it. You can do this by defining a special variable and look for it:
#echo off
if not defined FOO (
set FOO=1
start /min "" %~0
exit /b
)
rem here whatever you wanted to do originally in the batch
As long as the FOO variable isn't defined (which is probably the default almost everywhere), this batch will launch itself minimized again, but with the variable defined first. Environments are passed to subprocesses, which is why this works.
you would generally need something else to run the script in that manor
i.e.
Create a shortcut, and set the “Run” field for the shortcut to “Minimized’.
Once you click or tab away from the cmd.exe window that the batch file is running it, it's "in the background" -- I'm not really sure what you want but it sounds like you might be asking how to run the batch file without displaying the cmd.exe window.
If so I can think of two ways: first, you can create a shortcut to the batch file, right click it, and in the properties there set the shortcut to run minimized (should be a drop down option next to Run).
You can also wrap invocation of the batch file in a VBScript file using Windows Script Host's shell object (calling the Run method) to run the batch file invisibly. Passing 0 as the intWindowStyle parameter will suppress display of a window or anything.
#Ghyath Serhal
I have used cmdow to do this on another program, it is an external application that can be used to modify the command prompt. To use it, you will need to either enter this code (see below) into it's own batch file, or into the command prompt, where it will run 'BatchFile.bat' with a hidden terminal window. I haven't found a way to use this in a single batch file, but I only found out about this today.
cmdow /run /hid 'BatchFile.bat'
Hope this helps.

Resources