It is currently May 2nd, 2024, 4:48 am

execute multi cmd

Get help with creating, editing & fixing problems with skins
Dishark
Posts: 8
Joined: February 21st, 2020, 6:02 pm

execute multi cmd

Post by Dishark »

Hi everyone,

I'm new on the forums, so if I'm not in the right place or my question is already asked ; please be indulgent

So for start my minecrfat server, i must execute 4 commands in the command prompt of windows.
So I asking myself is I can creat a rainmeter icon who can run this 4 commands ?
The idea is to click one time on a custom rainmeter icon for launch my server.

Thank for your help !
Last edited by Dishark on February 21st, 2020, 9:53 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: execute multi cmd

Post by jsmorley »

Dishark wrote: February 21st, 2020, 6:09 pm Hi everyone,

I'm new on the forums, so if I'm not in the right place or my question is already asked ; please be indulgent

So for start my minecrfat server, i must execute 4 commands in the command prompt of windows.
So I asking myself is I can creat a rainmeter icon who can run this 4 commands ?
The idea is to click one time on a custom rainmeter icon for launch my server.

Thank for your help !
LeftMouseUpAction=["command1.exe"][!Delay 1000]["command2.exe"][!Delay 1000]["command3.exe"][!Delay 1000]["command4.exe"]

This assumes you want a little delay between each command to give them time to run before executing the next one. You can play with the values for the !Delay bangs, or even remove them if they are not needed.

https://docs.rainmeter.net/manual/bangs/#Delay
Dishark
Posts: 8
Joined: February 21st, 2020, 6:02 pm

Re: execute multi cmd

Post by Dishark »

Maybe I'm wrong with the syntax but I try like that and it don't work

Code: Select all

LeftMouseUpAction=["cd.."][!Delay 1000]["J:"][!Delay 1000]["cd J:\Minecraft\SERVEUR\1.14.4"][!Delay 1000]["java -Xmx4G -jar mojang_1.14.4.jar"]
So i try with ".exe" at the end but it's the same

I show you my command, it's can help

cd..
J:
cd J:\Minecraft\SERVEUR\1.14.4
java -Xmx4G -jar mojang_1.14.4.jar
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: execute multi cmd

Post by jsmorley »

Dishark wrote: February 21st, 2020, 6:28 pm Maybe I'm wrong with the syntax but I try like that and it don't work

Code: Select all

LeftMouseUpAction=["cd.."][!Delay 1000]["J:"][!Delay 1000]["cd J:\Minecraft\SERVEUR\1.14.4"][!Delay 1000]["java -Xmx4G -jar mojang_1.14.4.jar"]
So i try with ".exe" at the end but it's the same

I show you my command, it's can help

cd..
J:
cd J:\Minecraft\SERVEUR\1.14.4
java -Xmx4G -jar mojang_1.14.4.jar
Yeah, those DOS / cmd commands are not going to work this way. My advice is to create a .bat batch file, and just execute that.

I would think in that case that you might want to use Start to launch java.
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: execute multi cmd

Post by Yincognito »

Dishark wrote: February 21st, 2020, 6:28 pm Maybe I'm wrong with the syntax but I try like that and it don't work

Code: Select all

LeftMouseUpAction=["cd.."][!Delay 1000]["J:"][!Delay 1000]["cd J:\Minecraft\SERVEUR\1.14.4"][!Delay 1000]["java -Xmx4G -jar mojang_1.14.4.jar"]
So i try with ".exe" at the end but it's the same

I show you my command, it's can help

cd..
J:
cd J:\Minecraft\SERVEUR\1.14.4
java -Xmx4G -jar mojang_1.14.4.jar
You can follow jsmorley's advice, and assuming you make the batch file correctly, it will work. One other solution is to use fully qualified paths when executing things. So, even though I'm not familiar with your setup and I never played Minecraft:
- java is probably the Java Runtime Environment in your OS, so it will probably have a fully qualified path of, say, c:\Program Files\Java\jre1.8.0_191\bin\java.exe
- the -Xmx4G -jar are most likely the arguments that java.exe is using, so no change should be required
- the mojang_1.14.4.jar part is probably a file in the J:\Minecraft\SERVEUR\1.14.4 folder, so the fully qualified path for that would be J:\Minecraft\SERVEUR\1.14.4\mojang_1.14.4.jar

All these things considered, I think you might have more success using a single command in the LeftMouseUpAction, something along the lines of:

Code: Select all

LeftMouseUpAction=["c:\Program Files\Java\jre1.8.0_191\bin\java.exe -Xmx4G -jar J:\Minecraft\SERVEUR\1.14.4\mojang_1.14.4.jar"]
Notes:
- you should replace the 1.8.0_191 version of JRE with JRE's version number on your system - just look in C:\Program Files\Java to see it
- if this doesn't work from the start, you might want to add appropriate (single/double, can't remember which) quotes to enclose the fully qualified paths that have spaces in their names
- I don't know if that's the case, but JRE would possibly want to run in an appropriate "starting folder". If so, you may want to change your approach a bit and use the RunCommand plugin's StartInFolder option, instead of plain execution of the program
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Dishark
Posts: 8
Joined: February 21st, 2020, 6:02 pm

Re: execute multi cmd

Post by Dishark »

I first tried to do 4 .bat file with my "commands' but it didn't work. It's open 4 windows of cmd prompt.

So I researched on the internet how to creat a .bat file correctly I don't find solutions for my configuration.

So I goback to rainmeter forum and I saw your messages Yincognito.
For explain what I know

Code: Select all

-Xmx4G -jar
it's just for allocate 4Go of RAM for my server. By default it's 500mb and I don't know how to set 4Go by default.
So, for me, the only way to run my server at 4Go it's to execute this commands in windows prompt.

Until I figure out how to make right .bat file or change the default RAM I use windows prompt and write 4 commands or

Code: Select all

LeftMouseUpAction=[J:\Minecraft\SERVEUR\1.14.4\mojang_1.14.4.jar]
and I don't have my 4Go of RAM (but when there are 2-3 players it's work)

Thank guys for your help !

I need to deepen my knowledge in .bat file or setup mc sever with Paper
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: execute multi cmd

Post by Yincognito »

Dishark wrote: February 21st, 2020, 8:30 pm I first tried to do 4 .bat file with my "commands' but it didn't work. It's open 4 windows of cmd prompt.

So I researched on the internet how to creat a .bat file correctly I don't find solutions for my configuration.

So I goback to rainmeter forum and I saw your messages Yincognito.
For explain what I know

Code: Select all

-Xmx4G -jar
it's just for allocate 4Go of RAM for my server. By default it's 500mb and I don't know how to set 4Go by default.
So, for me, the only way to run my server at 4Go it's to execute this commands in windows prompt.

Until I figure out how to make right .bat file or change the default RAM I use windows prompt and write 4 commands or

Code: Select all

LeftMouseUpAction=[J:\Minecraft\SERVEUR\1.14.4\mojang_1.14.4.jar]
and I don't have my 4Go of RAM (but when there are 2-3 players it's work)

Thank guys for your help !

I need to deepen my knowledge in .bat file or setup mc sever with Paper
I see. That's odd, as Rainmeter barely takes a couple of MB of RAM, so it should have no problem in executing the command and still allow the program to use the 4GB of RAM available. Building a batch file is quite easy, for non-complex situations all you have to do is write the CMD commands separated by Enter and that's it.

Too bad I can't replicate your setup and see why it isn't working, as this should be trivial to accomplish, really...

EDIT: Maybe you coud make one last attempt, by putting this in the skin:

Code: Select all

LeftMouseUpAction=['"c:\Program Files\Java\jre1.8.0_191\bin\java.exe" -Xmx4G -jar "J:\Minecraft\SERVEUR\1.14.4\mojang_1.14.4.jar"']
or this:

Code: Select all

LeftMouseUpAction=["c:\Program Files\Java\jre1.8.0_191\bin\java.exe" "-Xmx4G -jar J:\Minecraft\SERVEUR\1.14.4\mojang_1.14.4.jar"]
or this:

Code: Select all

LeftMouseUpAction=['"c:\Program Files\Java\jre1.8.0_191\bin\java.exe" "-Xmx4G -jar J:\Minecraft\SERVEUR\1.14.4\mojang_1.14.4.jar"']
Notice that in some instances there are also apostrophes (i.e. ') in the command string, make sure you copy-paste them in order to write them exactly as they are (but as I said, replace the jre1.8.0_191 folder name with the name of the subfolder that exists in your c:\Program Files\Java folder). Who knows, maybe this time you'll get lucky and succeed...
Last edited by Yincognito on February 21st, 2020, 9:02 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Dishark
Posts: 8
Joined: February 21st, 2020, 6:02 pm

Re: execute multi cmd

Post by Dishark »

I tried this but it's doesn't work

Code: Select all

cmd cd..
cmd J:
cmd cd J:\Minecraft\SERVEUR\1.14.4
cmd java -Xmx8G -jar mojang_1.14.4.jar
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: execute multi cmd

Post by Yincognito »

Dishark wrote: February 21st, 2020, 8:53 pm I tried this but it's doesn't work

Code: Select all

cmd cd..
cmd J:
cmd cd J:\Minecraft\SERVEUR\1.14.4
cmd java -Xmx8G -jar mojang_1.14.4.jar
No. You don't have to write cmd in front of each command, as the batch (i.e. the .bat file) already runs in the CMD environment. Other than that, you do things in the wrong order - it should be something like:

Code: Select all

"c:\Program Files\Java\jre1.8.0_191\bin\java.exe" -Xmx8G -jar "J:\Minecraft\SERVEUR\1.14.4\mojang_1.14.4.jar"
Basically, you first go to the java folder, execute its .exe with the parameters and the mojang file's path comes last.

I don't have a mojang file on my system, so I get an error that java can't find it, but the above should work in your case. Just paste the above line in a .bat file you create (say, on the desktop, for simplicity) and see if it does the job. Be sure to replace the jre1.8.0_191 part according to the java version in your system.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Dishark
Posts: 8
Joined: February 21st, 2020, 6:02 pm

Re: execute multi cmd

Post by Dishark »

I tried my best for copy paste your commands without syntaxes issues and it didn't work

I checked my java folder and i saw

Code: Select all

jre1.8.0_181
So I re-try with changing 191 by 181 and it still hasn't worked

I appreciate your help, really, but I don't know what to do :(
Is there a way to see why the commands don't run successfully ?