10

I need to convert a .sh file to a .bat file so that it can run on windows I was wondering if there is a way to do so?
Here is the code i want to convert:

export ANDROID_SDK=C:\Users\Spencer Von Der Ohe\Downloads\adt-bundle-windows-x86_64-20140702\sdk
#
#
export HERE=${PWD}
export DALVIK_SDK=$HERE/../../
export JAVAFX_APP_DIR=$HERE/javafx/build/libs
export PATH=$ANDROID_SDK/tools:$PATH
export WORKDIR=$HERE/android
export PACKAGE="org.javafxports.helloworld"
export NAME="HelloAndroid"
./gradlew --info createProject -PDEBUG -PDIR=$WORKDIR -PPACKAGE=$PACKAGE -PNAME=$NAME  \
-PANDROID_SDK=$ANDROID_SDK -PJFX_SDK=$DALVIK_SDK -PJFX_APP=$JAVAFX_APP_DIR -PJFX_MAIN=$PACKAGE.$NAME

Any help will be greatly appreciated.

1 Answers1

18

your original .sh file just (1) sets some environment variables using the export command and then (2) invokes an executable.

It should be pretty straightforward to translate it to .BAT.

  1. Read HELP SET

  2. change all the export commands to SET

  3. change all references of $variable to %VARIABLE%

  4. change ${PWD} to %CD%

  5. read HELP SETLOCAL

  6. add setlocal as first line of the bat file

  7. (optional) add endlocal as last line of the bat file

  8. (suggestion for testing) insert ECHO in front of the command invocation

PA.
  • 28,486
  • 9
  • 71
  • 95