Can you convert a .sh file to a .bat file?

I need to convert a .sh file to a .bat file so that it can run in windows. I was wondering if there is a way to do this?
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 would be greatly appreciated.

+6
source share
1 answer

your source .sh file simply (1) sets some environment variables using the export command, and then (2) calls the executable.

It should be pretty simple to translate to .BAT .

  • Read the HELP SET

  • change all export commands to SET

  • change all links of $variable to %VARIABLE%

  • change ${PWD} to %CD%

  • read HELP SETLOCAL

  • add setlocal as the first line of the bat file

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

  • (suggestion for testing) insert ECHO before calling the command

+9
source

Source: https://habr.com/ru/post/978242/


All Articles