Changing a .bat to a .jar - batch-file

Sorry if this is a very simple solution, but I have searched and couldn't find an answer, and have limited programming experience. What I am trying to accomplish is making Minecraft download and run outside of %appdata% on windows. I would like it to download .minecraft to a separate folder and run from there. To accomplish this, I wrote a .bat file with this code:
set APPDATA=%CD%\data
bin\minecraft.exe
this worked PERFECTLY. The catch is, I have a friend's computer that I want to do the same on, which runs Ubuntu. Is there a way to write one .jar file that works exactly the same that would work for both windows and linux? Thank you in advance for the help :)

No, just write
#!/bin/sh
APPDATA=somewhereorother/data bin/minecraft
chmod +x it, and use that for Linux.

Related

How to Create a Simple Batch file for Application Uninstall via CMD?

I am inquiring assistance on creating a simple batch file in order to help field techs at my job remove the Microsoft Exchange Management Console via CMD batch. But for some reason i have been unsuccessful at being to accomplish this.
To my understanding its a matter of changing directories and running a uninstaller.
If i do it manually Run CMD as Admin and copy and paste
cd %ProgramFiles%\Microsoft\Exchange Server\v14\bin\setup.com /m:uninstall
This works flawlessly however when trying to compose it into a batch no go.
#echo off
cd D/ c:\
%ProgramFiles%\Microsoft\Exchange Server\v14\bin\setup.com /m:uninstall
And in theory i am assuming this should do it simple and so i thought but i can not get this thing going. I know i am missing something.
Can someone shed some light on the subject i would be most appreciated.
Thank You.
CD is the command to 'Change Directory'. Try this line to perform the uninstall.
"%ProgramFiles%\Microsoft\Exchange Server\v14\bin\setup.com" /m:uninstall
You need the quotes to handle the spaces in that path. And it is good practice. For future posts remember that it is helpful if you indicate what error or result you are getting.

Create a Windows executable (.exe) from Batch and Vbscript

It is asked me to create a Windows executable (.exe) from scripts written in batch and vbscript. unluckily I don't know which tool use to realize that. Therefore Let me ask you some questions which torment my spirit
Is it possible to make a such build?
If it is, could you recommend me some open tools which do that?
To make an exe from bat+vbs, do you think I have to modify the
content of my scripts alot/a little?
Thank in advance for your feedback
Bat2Exe converts batch files including any other files in a certain folder into executables
http://www.bat2exe.net
"ExeScript Editor" can convert batch files under .bat and .cmd also it can convert .vbs and .vbscript file into a .exe
http://www.scriptcode.com/vbscripteditor/
What you want to do is:
First : Join the bat files and vbs files together in one file.
Second: "Make" a executable of that file to launch the main bat file.
Bat/VBS file can't be compiled, when you see a "compiled bat" it's only a simple .exe stub, the bat is not compiled neither converted, is only stored, so first you need to use a joiner and second you need to use a bat-2-exe "converter" like "ExeScript Editor", searching for the crack in Google to evaluate the program is not hard, I have it.
...But really the best you can do is to use WinRAR application with the SFX options which can join files (compress), make the exe, and can launch the main bat file after silent extraction.
PS: Really the best you can do is to learn the basic things of a real lenguage, embbed the bat/vbs files as resources and then compile it into a standalone executable.

Make netbeans use virtual box guest installation of phpunit

We use netbean's phpunit / unit testing plugins for all our testing. We used to use xampp and point netbeans at our our .bat file from the xampp installation. We recently started using vagrant and are now running our dev environment in virtual box. I would like to make netbeans use the installation of phpunit within the virtual machine. This would save us from having to have both installed. Is this even possible? Netbeans seems to want a file location and I am stumped as to how I can go about doing this.
[EDIT] I've created a custom batch file that uses vbox guestconrols to forward the commands to the VMs installation of phpunit. I am going to then point netbeans at my custom .bat file. My problem is, now, that guestcontrols doesn't seem to be forwarding --bootstrap. It seems to be trying to take it and use it, rather than forward it along. The docs say that all the additional arguments will just be passed on, but that doesn't seem to be the case. Here is what I am using in my my_phpunit.bat :
[my_phpunit.bat]
#echo off
if "%VBoxManage%" == "" set VBoxManage=C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
"%VBoxManage%" "--nologo" "guestcontrol" "<my_vm_name>" "execute" "--image" "/usr/bin/php5" "/usr/bin/phpunit" "--verbose" "--username" "<user>" "--password" "<pass>" "--wait-stdout" "--wait-stderr" "CustomNetbeansTestSuite" "<path/to/test/suite>" "--bootstrap" "<path/to/bootstrap>" %7
I am almost there, as running the bat file without the bootstrap option at the end takes me to the unit test. I am getting exceptions because of some autoloader issues(no bootstrap), but if I can figure out a better way to forward these command line arguments to
[EDIT 2]
I think I've finally solved this, but I need to get some issues with my guest OS in order. Once I've been able to test it a bit more, I'll post the final solution. I solved the Vbox guest control issue by adding "--" before I actually sent the parameters that should be forwarded. It said to do so in the docs, but it wasn't entirely clear to me at first.
I just wanted to update that I never actually got the .bat file to work. I think I got pretty close, but I was hung up on some linux CLI output that I couldn't suppress. The .bat file that I ended up with was:
# .bat example
https://pastebin.com/BX1xnL3q
I ended up moving to PhpStorm and everything worked out of the box. So, if you're still using netbeans, you can try and give that a shot. Maybe someone with more unix / linux experience can fix the issues I was having. I feel I was like 99% there with it.

How can I take a .exe ported from python (py2exe) and run it as a background process?

I wrote a program in IDLE and made it into an EXE via py2exe. I want it to run in the background and whenever I start up my computer. How could I do this? Should I implement a piece of code into the original script, or do I need to create a BATCH file, or do I need to do something else? I'm fairly new to programming so I'm sorry if this is a stupid question.
Add it to your startup folder:
C:\users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
For one user;
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
For all users.

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