making .exe from .bat file tools and solution with dependencies - batch-file

I have got a solution that uses a .bat file to start. I need to make it a .exe. I have used different tools like [BATch to EXE], [Bat_to_exe_converter], Bat to Exe Converter from [f2ko] which was the most modern one. I need help on the last one which is more sensible to work. or any other solution that makes a working .exe file. Right now, after converting the file to exe according to dependencies the start-up process will not complete. I should mention that the bat file is the Pentaho start-up file.
I have also used IEXPRESS from windows but the error after running the result exe is:
"Error creating process . Reason: The system cannot find the file specified."
Thanks,

Sounds like you need Carte. Carte is a web service that allows remote execution of jobs and transforms.
Carte User Doumentation
You'll probably also need to see this:
Carte as a Windows Service

Related

Need to convert my Runnable JAR file into a batch file?

I have a working Jar file. It is a Web automation where when I run the code some steps are happening over a URL. (which include pressing of few buttons also).
Now I want this to run when my machine is off. For that i need to schedule a windows job in task scheduler. Is it possible to convert my runnable jar into a batch file and then add a job in scheduler an do the steps when i am offline?
My code looks like this:
System.setProperty("webdriver.ie.driver", "C:\\Users\\x201691\\eclipse-workspace\\Mt_CacheFlush\\exefiles\\IEDriverServer.exe");
WebDriver driver=new InternetExplorerDriver(); driver.get("abc.com");
driver.findElement(By.id("overridelink")).click();
driver.findElement(By.name("password")).sendKeys("abc");
driver.findElement(By.xpath("//input[#value='Login']")).click();
driver.findElement(By.xpath("//div[#class='textMainNav' and normalize-space()='Overview']")).click();
System.out.println(driver.getTitle());
I can't make sense of "convert" a JAR into a batch file. There's no automatic conversion between the two.
If you only want to launch the JAR file from a batch file, you can
path\to\particular\jre\java -jar path\to\archive.jar
From there, you can create a scheduled task (Task Scheduler) that invokes the batch file for whatever criteria you have. IDK if Windows can actually turn the computer on in order to run a task, but if it's already running, you can certainly have the script run whether you're logged in or not.
From what I know, I don't think it's possible to convert a a JAR file into a Batch file. However, if you are insistent on running the JAR file from some form of Batch, you can create an extremely small batch file that will run the JAR file for you, that looks like this:
:start
START C:\<path-to-jar-file>
EXIT
Now, you can go into the task scheduler, and create a task that starts this batch file, then closes itself. I hope this helps!

background process launched by TFS is killed when switching to next step

I have some trouble keeping alive a background process when launched by TFS.
Usually I use a batch that launch a java server (new window), as long as I keep this window open it works properly.
C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk\server.bat
In order to make my process automatic, I include this in TFS. In the step I call a batch that contains the following:
cd C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk // necessary to find the batch
start C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk\server.bat
In my task manager, I can see in background tasks that java is launched (no new window is opened), exactly as it behaves when launching directly the batch. But after a few seconds, when TFS switches to the next step, it stops.
Then the next step carries on but fails as it requires the server to be launched.
Is there a particular way of doing it in TFS ?
thank you
Alexandre
It's suggest to launch the .bat file from a relative path not directly use cd to hard code the path.
Also recommend you to use Run Batch File task not Run Command Line task to launch the .bat file.
According to your description, seems you are using a run command line task in your build pipeline. Then run the command under the working directory c:\Build_work\5\s, the command cd to C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk\ on the build agent, find the server.bat, run the server.bat.
First check if the .bat file is located at the path you are specifying on the build agent. Not sure if the bat file have to run under C:\Users\TFSService\mbs-iot-sdk\osgi\bin\vms\jdk\, guess you are also hard code the path in your server.bat file. Suggest you change all the path to relative path, you could use some built-in variable in TFS.
As for your workaround in comment, seems you want to chain builds in TFS. The official docs literally say "not yet" and have a uservoice in planed. However you could use some workaround, such as create or use other's customize extension (use rest api) to call another build. Detail ways please refer huserben's answer in this question: How to chain builds in TFS 2015?
Note sure you have to go deep into this area for your original issue. Just add some related info in case you are interested or need.
Well,
Just in case someone else goes through the same kind of issue, I found a workaround:
I wish to mix different command line steps, some of them launching Python scripts:
I have one step for launching the server that is required for my testing tool, one step for my testing tool and one Python step for differential testing
I realized that I could embed everything in a Python script.
It can handle server launching process in a separate window (with subprocess), launch my Python part and launch another process for my validation tool.
I have to test the whole chain but, at least, I solved my problem of launching a background process and detach it from TFS

Batch File not starting automatically as a service

i am having trouble while starting a batch file as a service. the batch file runs fine when started manually but it doesnt starts a service and no ouput is observed. i have used nssm service manager to start the service.
below are the commands which i have used :
D:\nssm-2.24\win32>nssm install call
D:\nssm-2.24\win32>nssm start call
while installing i have provided the path of batch file.
the batch file contains the windows script to start few programs automatically.
you cannot just install any old executable as a service, and certainly not a batch file. a service is a program with a specific API which makes it react to service manager calls. ignore that, i just read up on nssm. still, there are probably better ways.
your use case sound rather like you might want to put your batch file in the autostart startmenu folder, to run it at login/startup.
or a scheduled task, if you want to restart it regularly.
one thing to consider, too, is the user under which the script is executed.

Make a Single EXE from BATCH and 2 EXEs

I have a script (a.bat) that calls 2 executables (b.exe and c.exe) and I would like to create a single exe that would call a.bat automatically.
Is it possible?
Any simple program to do this?
Ps.: Info: The Exe's do make other files that are deleted in the end
Not directly, no.
The simplest way to accomplish this with off-the-shelf tools is to use an archiver that can create self-extracting archives and allows to specify a file to run after extraction. For example, free Info-Zip tools support an autorun command. WinRAR (commercial) allows to define complex scripts with GUI.
An install engine can be used for the same purpose. For a couple of examples, there are NSIS and Inno Setup (both free).
A (relatively) more complex solution is to write a third executable that will extract payload from its resources and run the batch file. This way you have full control over what happens.
This One:Bat To Exe Converter
It has the "Include" option that can include the exe file
when the compiled exe file run
it will release it
and you can run it!

Winzip hanging up in scheduled task batch file

I have a simple batch file as seen below that should extract a zip file to the root of E:. The zip file is valid and I can run the batch file from the command line just fine.
Instead of completing the task, it continues to inform me that the Status is "Running". The problem is, it is not running and the file never gets unzipped.
The task is running as a Domain Admin that has been specifically added as an Admin on the box.
Are there any known problems with using zip files in Scheduled Tasks. I actually have this same problem on 3 out of the 12 boxes this task runs on, but there is no rhyme nor reason as to why some servers work, and others don't.
Any ideas on how to debug what is going on, or a solution would be very helpful.
Here is the batch file I'm attempting to run.
SET RootPath=E:
SET WinzipLocation=E:\Program Files\WinZip
"%WinzipLocation%\winzip32" -e -o %CD%\TestZipFile.zip %RootPath%
Try to use the WinZip Command Line Support Add-on.
what if you use 7-zip in command line?
I realized after posting that the "bad" servers were all 64-bit. I was running the 32-bit version of winzip. Since the company I work for doesn't see the benefit in purchasing any software, I had no other option but to starting using 7-zip. I have not tested for any performance increases or hits, but I do not that it works, regardless of the environment.
Thanks for the answers, but it looks like without the 64-bit version of winzip....i have no other options.

Resources