Can someone convert this batch file into a vbs please?

Discussion in 'Software' started by Heaney, Jun 21, 2011.

  1. Heaney

    Heaney Private E-2

    Here is a batch file I made, so that I can run Minecraft on a computer where I don't have access to the real %Appdata%, so it makes Minecraft think that Appdata is at N:\data !

    Code:
    @echo off
    SET APPDATA=N:\data\
    Start  "Minecraft" "N:\minecraft.jar"
    
    Now, the problem is- on this system we are not allowed to use the command prompt AT ALL.

    So batch files won't work.

    However, we CAN use vbs files.

    I was wondering if any of you incredibly nice people ( ;) ) could convert this basic batch file into a vbs that will do exactly the same thing.

    Thanks in advance.
     
  2. GermanOne

    GermanOne Guest

    Try something like that:
    Code:
    Set objWSH = CreateObject("WScript.Shell")
    objWSH.Environment("PROCESS")("APPDATA") = "N:\data"
    objWSH.Run "N:\minecraft.jar"
    
    Regards
    GermanOne
     
  3. Heaney

    Heaney Private E-2

    Thank you! :)

    I will test this tomorrow.
     
  4. GermanOne

    GermanOne Guest

    You should also test this 3rd line:
    Code:
    objWSH.Run """Minecraft"" ""N:\minecraft.jar"""
    
    because I'm not sure about the meaning of "Minecraft" in your batch file (looks like wrong syntax).

    Regards
    GermanOne
     
  5. Heaney

    Heaney Private E-2

    It's irrelevant really, it just gives a name to what I'm running "Minecraft".
     
  6. GermanOne

    GermanOne Guest

    I feared there would be a minecraft.exe in the current directory.
    But now I assume the START line of your batch file has the right syntax, also my first code should work as provided.

    Regards
    GermanOne
     
  7. Heaney

    Heaney Private E-2

    Hi it's me again.

    It worked perfectly (thanks), but I'd like to give it 2048 MB of RAM.

    The Minecraft website says to run it as "java -Xmx2048M -Xms2048M -cp Minecraft.jar", but I don't know how to do this in vbs...
     
  8. GermanOne

    GermanOne Guest

    Depends on where java.exe ist placed on your drive.
    Try:
    Code:
    Set objWSH = CreateObject("WScript.Shell")
    objWSH.Environment("PROCESS")("APPDATA") = "N:\data"
    objWSH.Run """C:\Program Files\Java\jre6\bin\java.exe"" -Xmx2048M -Xms2048M -cp N:\minecraft.jar"
    
    But if you have another java version the path could also be different.

    Regards
    GermanOne
     
  9. Heaney

    Heaney Private E-2

    The java.exe is placed there (I checked), but this script does nothing.

    It brings up the command prompt for like 1 millisecond, and then nothing happens...
     
  10. GermanOne

    GermanOne Guest

    I'm not familiar with this computer game stuff. I had a look at my registry to figure out how .jar files are opened by default. For that reason you should try the following line
    Code:
    objWSH.Run """C:\Program Files\Java\jre6\bin\javaw.exe"" -Xmx2048M -Xms2048M -jar N:\minecraft.jar"
    
    Now also a message box should turn up if an error occures.

    Regards
    GermanOne
     
  11. Heaney

    Heaney Private E-2

    Now I get "cannot create the virtual machine...".

    But at least I got something there, lol.
     
  12. GermanOne

    GermanOne Guest

    Did you use option -cp or option -jar ?
     
  13. Heaney

    Heaney Private E-2

  14. GermanOne

    GermanOne Guest

    Seems you try to allocate too much RAM space. As far as I know the limit on 32bit systems is 1536 MB (not sure).

    Regards
    GermanOne
     
  15. Heaney

    Heaney Private E-2

    That was the problem!

    Thank you again :)
     
  16. GermanOne

    GermanOne Guest

    Happy to help you ;)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds