Home > Software engineering >  Output path from a minecraft 1.8.8 json file using only batch
Output path from a minecraft 1.8.8 json file using only batch

Time:11-16

So,I am trying to collect paths from the minecraft 1.8.8 json file only using json file,

Here is the content of 1.8.8.json (if you don't khow):

{"assetIndex":{"id":"1.8","sha1":"f6ad102bcaa53b1a58358f16e376d548d44933ec","size":78494,"totalSize":114885064,"url":"https://launchermeta.mojang.com/v1/packages/f6ad102bcaa53b1a58358f16e376d548d44933ec/1.8.json"},"assets":"1.8","complianceLevel":0,"downloads":{},"id":"BatMod","javaVersion":{"component":"jre-legacy","majorVersion":8},"mainClass":"net.minecraft.client.main.Main","minecraftArguments":"--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}","minimumLauncherVersion":14,"releaseTime":"2015-12-03T09:24:39 00:00","time":"2015-12-03T09:24:39 00:00","type":"release","logging":{"client":{"argument":"-Dlog4j.configurationFile=${path}","file":{"id":"client-1.7.xml","sha1":"6605d632a2399010c0085d3e4da58974d62ccdfe","size":871,"url":"https://launcher.mojang.com/v1/objects/6605d632a2399010c0085d3e4da58974d62ccdfe/client-1.7.xml"},"type":"log4j2-xml"}},"libraries":[{"name":"com.mojang:netty:1.6","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/mojang/netty/1.6/netty-1.6.jar","sha1":"4b75825a06139752bd800d9e29c5fd55b8b1b1e4","size":7877}}},{"name":"oshi-project:oshi-core:1.1","downloads":{"artifact":{"url":"https://libraries.minecraft.net/oshi-project/oshi-core/1.1/oshi-core-1.1.jar","sha1":"9ddf7b048a8d701be231c0f4f95fd986198fd2d8","size":30973}}},{"name":"net.java.dev.jna:jna:3.4.0","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar","sha1":"803ff252fedbd395baffd43b37341dc4a150a554","size":1008730}}},{"name":"net.java.dev.jna:platform:3.4.0","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar","sha1":"e3f70017be8100d3d6923f50b3d2ee17714e9c13","size":913436}}},{"name":"com.ibm.icu:icu4j-core-mojang:51.2","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar","sha1":"63d216a9311cca6be337c1e458e587f99d382b84","size":1634692}}},{"name":"net.sf.jopt-simple:jopt-simple:4.6","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar","sha1":"306816fb57cf94f108a43c95731b08934dcae15c","size":62477}}},{"name":"com.paulscode:codecjorbis:20101023","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar","sha1":"c73b5636faf089d9f00e8732a829577de25237ee","size":103871}}},{"name":"com.paulscode:codecwav:20101023","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/codecwav/20101023/codecwav-20101023.jar","sha1":"12f031cfe88fef5c1dd36c563c0a3a69bd7261da","size":5618}}},{"name":"com.paulscode:libraryjavasound:20101123","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar","sha1":"5c5e304366f75f9eaa2e8cca546a1fb6109348b3","size":21679}}},{"name":"com.paulscode:librarylwjglopenal:20100824","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar","sha1":"73e80d0794c39665aec3f62eee88ca91676674ef","size":18981}}},{"name":"com.paulscode:soundsystem:20120107","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar","sha1":"419c05fe9be71f792b2d76cfc9b67f1ed0fec7f6","size":65020}}},{"name":"io.netty:netty-all:4.0.23.Final","downloads":{"artifact":{"url":"https://libraries.minecraft.net/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar","sha1":"0294104aaf1781d6a56a07d561e792c5d0c95f45","size":1779991}}},{"name":"com.google.guava:guava:17.0","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/google/guava/guava/17.0/guava-17.0.jar","sha1":"9c6ef172e8de35fd8d4d8783e4821e57cdef7445","size":2243036}}},{"name":"org.apache.commons:commons-lang3:3.3.2","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar","sha1":"90a3822c38ec8c996e84c16a3477ef632cbc87a3","size":412739}}},{"name":"commons-io:commons-io:2.4","downloads":{"artifact":{"url":"https://libraries.minecraft.net/commons-io/commons-io/2.4/commons-io-2.4.jar","sha1":"b1b6ea3b7e4aa4f492509a4952029cd8e48019ad","size":185140}}},{"name":"commons-codec:commons-codec:1.9","downloads":{"artifact":{"url":"https://libraries.minecraft.net/commons-codec/commons-codec/1.9/commons-codec-1.9.jar","sha1":"9ce04e34240f674bc72680f8b843b1457383161a","size":263965}}},{"name":"net.java.jinput:jinput:2.0.5","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar","sha1":"39c7796b469a600f72380316f6b1f11db6c2c7c4","size":208338}}},{"name":"net.java.jutils:jutils:1.0.0","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar","sha1":"e12fe1fda814bd348c1579329c86943d2cd3c6a6","size":7508}}},{"name":"com.google.code.gson:gson:2.2.4","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar","sha1":"a60a5e993c98c864010053cb901b7eab25306568","size":190432}}},{"name":"com.mojang:authlib:1.5.21","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar","sha1":"aefba0d5b53fbcb70860bc8046ab95d5854c07a5","size":64412}}},{"name":"com.mojang:realms:1.7.39","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/mojang/realms/1.7.39/realms-1.7.39.jar","sha1":"c282954ce2a3bc62812e0d41c05f179b3b5839d7","size":443224}}},{"name":"org.apache.commons:commons-compress:1.8.1","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar","sha1":"a698750c16740fd5b3871425f4cb3bbaa87f529d","size":365552}}},{"name":"org.apache.httpcomponents:httpclient:4.3.3","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar","sha1":"18f4247ff4572a074444572cee34647c43e7c9c7","size":589512}}},{"name":"commons-logging:commons-logging:1.1.3","downloads":{"artifact":{"url":"https://libraries.minecraft.net/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar","sha1":"f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f","size":62050}}},{"name":"org.apache.httpcomponents:httpcore:4.3.2","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar","sha1":"31fbbff1ddbf98f3aa7377c94d33b0447c646b6e","size":282269}}},{"name":"org.apache.logging.log4j:log4j-api:2.0-beta9","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar","sha1":"1dd66e68cccd907880229f9e2de1314bd13ff785","size":108161}}},{"name":"org.apache.logging.log4j:log4j-core:2.0-beta9","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar","sha1":"678861ba1b2e1fccb594bb0ca03114bb05da9695","size":681134}}},{"name":"org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209","rules":[{"action":"allow"},{"action":"disallow","os":{"name":"osx"}}],"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar","sha1":"697517568c68e78ae0b4544145af031c81082dfe","size":1047168}}},{"name":"org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209","rules":[{"action":"allow"},{"action":"disallow","os":{"name":"osx"}}],"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar","sha1":"d51a7c040a721d13efdfbd34f8b257b2df882ad0","size":173887}}},{"name":"org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209","rules":[{"action":"allow"},{"action":"disallow","os":{"name":"osx"}}],"natives":{"osx":"natives-osx","linux":"natives-linux","windows":"natives-windows"},"extract":{"exclude":["META-INF/"]},"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209.jar","sha1":"b04f3ee8f5e43fa3b162981b50bb72fe1acabb33","size":22},"classifiers":{"natives-windows":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-windows.jar","sha1":"b84d5102b9dbfabfeb5e43c7e2828d98a7fc80e0","size":613748},"natives-osx":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-osx.jar","sha1":"bcab850f8f487c3f4c4dbabde778bb82bd1a40ed","size":426822},"natives-linux":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-linux.jar","sha1":"931074f46c795d2f7b30ed6395df5715cfd7675b","size":578680}}}},{"name":"org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-20140822","rules":[{"action":"allow","os":{"name":"osx"}}],"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl/2.9.2-nightly-20140822/lwjgl-2.9.2-nightly-20140822.jar","sha1":"7707204c9ffa5d91662de95f0a224e2f721b22af","size":1045632}}},{"name":"org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-20140822","rules":[{"action":"allow","os":{"name":"osx"}}],"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl_util/2.9.2-nightly-20140822/lwjgl_util-2.9.2-nightly-20140822.jar","sha1":"f0e612c840a7639c1f77f68d72a28dae2f0c8490","size":173887}}},{"name":"org.lwjgl.lwjgl:lwjgl-platform:2.9.2-nightly-20140822","rules":[{"action":"allow","os":{"name":"osx"}}],"natives":{"osx":"natives-osx","linux":"natives-linux","windows":"natives-windows"},"extract":{"exclude":["META-INF/"]},"downloads":{"classifiers":{"natives-windows":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-windows.jar","sha1":"78b2a55ce4dc29c6b3ec4df8ca165eba05f9b341","size":613680},"natives-osx":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-osx.jar","sha1":"79f5ce2fea02e77fe47a3c745219167a542121d7","size":468116},"natives-linux":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-linux.jar","sha1":"d898a33b5d0a6ef3fed3a4ead506566dce6720a5","size":578539}}}},{"name":"net.java.jinput:jinput-platform:2.0.5","natives":{"osx":"natives-osx","linux":"natives-linux","windows":"natives-windows"},"extract":{"exclude":["META-INF/"]},"downloads":{"classifiers":{"natives-windows":{"url":"https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar","sha1":"385ee093e01f587f30ee1c8a2ee7d408fd732e16","size":155179},"natives-osx":{"url":"https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar","sha1":"53f9c919f34d2ca9de8c51fc4e1e8282029a9232","size":12186},"natives-linux":{"url":"https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar","sha1":"7ff832a6eb9ab6a767f1ade2b548092d0fa64795","size":10362}}}},{"name":"tv.twitch:twitch:6.5","downloads":{"artifact":{"url":"https://libraries.minecraft.net/tv/twitch/twitch/6.5/twitch-6.5.jar","sha1":"320a2dfd18513a5f41b4e75729df684488cbd925","size":55977}}},{"name":"tv.twitch:twitch-platform:6.5","rules":[{"action":"allow"},{"action":"disallow","os":{"name":"linux"}}],"natives":{"osx":"natives-osx","linux":"natives-linux","windows":"natives-windows-${arch}"},"extract":{"exclude":["META-INF/"]},"downloads":{"classifiers":{"natives-windows-64":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-windows-64.jar","sha1":"9fdd0fd5aed0817063dcf95b69349a171f447ebd","size":580098},"natives-osx":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-osx.jar","sha1":"5f9d1ee26257b3a33f0ca06fed335ef462af659f","size":455359},"natives-windows-32":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-windows-32.jar","sha1":"206c4ccaecdbcfd2a1631150c69a97bbc9c20c11","size":474225}}}},{"name":"tv.twitch:twitch-external-platform:4.5","rules":[{"action":"allow","os":{"name":"windows"}}],"natives":{"windows":"natives-windows-${arch}"},"extract":{"exclude":["META-INF/"]},"downloads":{"classifiers":{"natives-windows-64":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-64.jar","sha1":"c3cde57891b935d41b6680a9c5e1502eeab76d86","size":7457619},"natives-windows-32":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-32.jar","sha1":"18215140f010c05b9f86ef6f0f8871954d2ccebf","size":5654047}}}}]}

(you propelly won't read it) My question is that how am i gonna get all the path that link to the libaries? Here is the batch script i have tested:

    for /f "tokens=1,2 delims=:{}, " %%A in (1.8.8.json) do (
    if %%~A==path (
    echo %%~B >> path.txt
    )
)

This work fine on 1.7.10 json file:

    {
   "assets": "1.7.10",
   "id": "CheatBreaker",
   "libraries": [
      {
         "downloads": {
            "artifact": {
               "path": "com/mojang/netty/1.6/netty-1.6.jar",
               "sha1": "4b75825a06139752bd800d9e29c5fd55b8b1b1e4",
               "size": 7877,
               "url": "https://libraries.minecraft.net/com/mojang/netty/1.6/netty-1.6.jar"
            }
         },
         "name": "com.mojang:netty:1.6"
      },
      {
         "downloads": {
            "artifact": {
               "path": "com/mojang/realms/1.3.5/realms-1.3.5.jar",
               "sha1": "0807ae355ee63583becd7ea60e76aab1532bb42e",
               "size": 353818,
               "url": "https://libraries.minecraft.net/com/mojang/realms/1.3.5/realms-1.3.5.jar"
            }
         },
         "name": "com.mojang:realms:1.3.5"
      },
      {
         "downloads": {
            "artifact": {
               "path": "org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar",
               "sha1": "a698750c16740fd5b3871425f4cb3bbaa87f529d",
               "size": 365552,
               "url": "https://libraries.minecraft.net/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar"
            }
         },
         "name": "org.apache.commons:commons-compress:1.8.1"
      },

         "name": "net.java.jinput:jinput:2.0.5"
      },
      {
         "downloads": {
            "artifact": {
               "path": "net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar",
               "sha1": "e12fe1fda814bd348c1579329c86943d2cd3c6a6",
               "size": 7508,
               "url": "https://libraries.minecraft.net/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar"
            }
         },
         "name": "net.java.jutils:jutils:1.0.0"
      },
      {
         "downloads": {
            "artifact": {
               "path": "com/google/code/gson/gson/2.2.4/gson-2.2.4.jar",
               "sha1": "a60a5e993c98c864010053cb901b7eab25306568",
               "size": 190432,
               "url": "https://libraries.minecraft.net/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar"
            }
         },
         "name": "com.google.code.gson:gson:2.2.4"
      },
      {
         "downloads": {
            "artifact": {
               "path": "com/mojang/authlib/1.5.21/authlib-1.5.21.jar",
               "sha1": "aefba0d5b53fbcb70860bc8046ab95d5854c07a5",
               "size": 64412,
               "url": "https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar"
            }
         },
         "name": "com.mojang:authlib:1.5.21"
      },
      {
         "downloads": {
            "artifact": {
               "path": "org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar",
               "sha1": "1dd66e68cccd907880229f9e2de1314bd13ff785",
               "size": 108161,
               "url": "https://libraries.minecraft.net/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar"
            }
         },
         "name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
      },
      {
         "downloads": {
            "artifact": {
               "path": "org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar",
               "sha1": "678861ba1b2e1fccb594bb0ca03114bb05da9695",
               "size": 681134,
               "url": "https://libraries.minecraft.net/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar"
            }
         },
         "name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
      },
      {
         "downloads": {
            "artifact": {
               "path": "org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.jar",
               "sha1": "f58c5aabcef0e41718a564be9f8e412fff8db847",
               "size": 1014790,
               "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.jar"
            }
         },
         "name": "org.lwjgl.lwjgl:lwjgl:2.9.1"
      },
      {
         "downloads": {
            "artifact": {
               "path": "org/lwjgl/lwjgl/lwjgl_util/2.9.1/lwjgl_util-2.9.1.jar",
               "sha1": "290d7ba8a1bd9566f5ddf16ad06f09af5ec9b20e",
               "size": 173909,
               "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl_util/2.9.1/lwjgl_util-2.9.1.jar"
            }
         },
         "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
      },
      {
         "downloads": {
            "classifiers": {
               "natives-linux": {
                  "path": "org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-linux.jar",
                  "sha1": "aa9aae879af8eb378e22cfc64db56ec2ca9a44d1",
                  "size": 571424,
                  "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-linux.jar"
               },
               "natives-osx": {
                  "path": "org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-osx.jar",
                  "sha1": "2d12c83fdfbc04ecabf02c7bc8cc54d034f0daac",
                  "size": 527196,
                  "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-osx.jar"
               },
               "natives-windows": {
                  "path": "org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-windows.jar",
                  "sha1": "4c517eca808522457dd95ee8fc1fbcdbb602efbe",
                  "size": 611334,
                  "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-windows.jar"
               }
            }
         },
         "extract": {
            "exclude": [
               "META-INF/"
            ]
         },
         "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
         "natives": {
            "linux": "natives-linux",
            "osx": "natives-osx",
            "windows": "natives-windows"
         }
      },
      {
         "downloads": {
            "classifiers": {
               "natives-linux": {
                  "path": "net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar",
                  "sha1": "7ff832a6eb9ab6a767f1ade2b548092d0fa64795",
                  "size": 10362,
                  "url": "https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar"
               },
               "natives-osx": {
                  "path": "net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar",
                  "sha1": "53f9c919f34d2ca9de8c51fc4e1e8282029a9232",
                  "size": 12186,
                  "url": "https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar"
               },
               "natives-windows": {
                  "path": "net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar",
                  "sha1": "385ee093e01f587f30ee1c8a2ee7d408fd732e16",
                  "size": 155179,
                  "url": "https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar"
               }
            }
         },
         "extract": {
            "exclude": [
               "META-INF/"
            ]
         },
         "name": "net.java.jinput:jinput-platform:2.0.5",
         "natives": {
            "linux": "natives-linux",
            "osx": "natives-osx",
            "windows": "natives-windows"
         }
      },
      {
         "downloads": {
            "artifact": {
               "path": "tv/twitch/twitch/5.16/twitch-5.16.jar",
               "sha1": "1f55f009c61637c10c0acfb8b5ffc600f30044b4",
               "size": 52315,
               "url": "https://libraries.minecraft.net/tv/twitch/twitch/5.16/twitch-5.16.jar"
            }
         },
         "name": "tv.twitch:twitch:5.16"
      },
      {
         "downloads": {
            "classifiers": {
               "natives-osx": {
                  "path": "tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-osx.jar",
                  "sha1": "62503ee712766cf77f97252e5902786fd834b8c5",
                  "size": 418331,
                  "url": "https://libraries.minecraft.net/tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-osx.jar"
               },
               "natives-windows-32": {
                  "path": "tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-32.jar",
                  "sha1": "7c6affe439099806a4f552da14c42f9d643d8b23",
                  "size": 386792,
                  "url": "https://libraries.minecraft.net/tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-32.jar"
               },
               "natives-windows-64": {
                  "path": "tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-64.jar",
                  "sha1": "39d0c3d363735b4785598e0e7fbf8297c706a9f9",
                  "size": 463390,
                  "url": "https://libraries.minecraft.net/tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-64.jar"
               }
            }
         },
         "extract": {
            "exclude": [
               "META-INF/"
            ]
         },
         "name": "tv.twitch:twitch-platform:5.16",
         "natives": {
            "linux": "natives-linux",
            "osx": "natives-osx",
            "windows": "natives-windows-${arch}"
         },
         "rules": [
            {
               "action": "allow"
            },
            {
               "action": "disallow",
               "os": {
                  "name": "linux"
               }
            }
         ]
      },
      {
         "downloads": {
            "classifiers": {
               "natives-windows-32": {
                  "path": "tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-32.jar",
                  "sha1": "18215140f010c05b9f86ef6f0f8871954d2ccebf",
                  "size": 5654047,
                  "url": "https://libraries.minecraft.net/tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-32.jar"
               },
               "natives-windows-64": {
                  "path": "tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-64.jar",
                  "sha1": "c3cde57891b935d41b6680a9c5e1502eeab76d86",
                  "size": 7457619,
                  "url": "https://libraries.minecraft.net/tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-64.jar"
               }
            }
         },
         "extract": {
            "exclude": [
               "META-INF/"
            ]
         },
         "name": "tv.twitch:twitch-external-platform:4.5",
         "natives": {
            "windows": "natives-windows-${arch}"
         },
         "rules": [
            {
               "action": "allow",
               "os": {
                  "name": "windows"
               }
            }
         ]
      }
   ],
   "logging": {
      "client": {
         "argument": "-Dlog4j.configurationFile=${path}",
         "file": {
            "id": "client-1.7.xml",
            "sha1": "6605d632a2399010c0085d3e4da58974d62ccdfe",
            "size": 871,
            "url": "https://launcher.mojang.com/v1/objects/6605d632a2399010c0085d3e4da58974d62ccdfe/client-1.7.xml"
         },
         "type": "log4j2-xml"
      }
   },
   etc...
   "mainClass": "net.minecraft.client.main.Main",
   "minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}",
   "minimumLauncherVersion": 13,
   "releaseTime": "2019-10-16T19:29:57 00:00",
   "time": "2014-05-14T17:29:23 00:00",
   "type": "release"
}

you can see that the json file above have the "path".what the batch file did is output all of the value of "path" into a text file called "path.txt".The code above work fine on 1.7.10.json file,but it never output anything when i try to use it with 1.8.8.json.

content of path.txt:

    com/mojang/netty/1.6/netty-1.6.jar 
    com/mojang/realms/1.3.5/realms-1.3.5.jar 
    org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar 
    org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar 
    commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar 
    org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar 
    java3d/vecmath/1.3.1/vecmath-1.3.1.jar 
    net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar 
    com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar 
    net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar 
    com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar 
    com/paulscode/codecwav/20101023/codecwav-20101023.jar 
    com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar 
    com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar 
etc...

from my look,There is the "url" value that store link to download these libaries. My guess is that we can use the url links to create path:Example:

https://libraries.minecraft.net/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar

We can reuse that link and turn it into a path,by deleting "https://libraries.minecraft.net/"

https://libraries.minecraft.net/ net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar (delete the blue bold one.)

So,how are we gonna erase that bold blue text,and only save the path into a txt file like path.txt using batch? (Sorry if my english is bad,english is not my main speaking thing.You can edit the if i write something wrong.)

CodePudding user response:

Remember that batch and cmd is not suitable to parse JSON file !

But if you insist to use a batch file just give a try with this ugly code :


@echo off
Set "PathLink=%~dp0PathLink.txt"
If Exist "%PathLink%" Del "%PathLink%"
SetLocal EnableDelayedExpansion
@for /f "tokens=1-3 delims=:{}, " %%A in (1.8.8.json) do (
    If /I %%~A==url (
        Set "link=%%~C"
        Set link=!link:"=!
        Set link=!link://libraries.minecraft.net/=!
        Set link=!link://launchermeta.mojang.com/=!
        Set link=!link://launcher.mojang.com/=!
        echo !link!>>"%PathLink%"
    )
)
Start "" /MAX "%PathLink%"
EXIT

As a result you can get :

v1/packages/f6ad102bcaa53b1a58358f16e376d548d44933ec/1.8.json
v1/objects/6605d632a2399010c0085d3e4da58974d62ccdfe/client-1.7.xml
com/mojang/netty/1.6/netty-1.6.jar
oshi-project/oshi-core/1.1/oshi-core-1.1.jar
net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar
net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar
com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar
net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar
com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar
com/paulscode/codecwav/20101023/codecwav-20101023.jar
com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar
com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar
com/paulscode/soundsystem/20120107/soundsystem-20120107.jar
io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar
com/google/guava/guava/17.0/guava-17.0.jar
org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar
commons-io/commons-io/2.4/commons-io-2.4.jar
commons-codec/commons-codec/1.9/commons-codec-1.9.jar
net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar
net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar
com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
com/mojang/authlib/1.5.21/authlib-1.5.21.jar
com/mojang/realms/1.7.39/realms-1.7.39.jar
org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar
org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar
org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar
org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-windows.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-osx.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-linux.jar
org/lwjgl/lwjgl/lwjgl/2.9.2-nightly-20140822/lwjgl-2.9.2-nightly-20140822.jar
org/lwjgl/lwjgl/lwjgl_util/2.9.2-nightly-20140822/lwjgl_util-2.9.2-nightly-20140822.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-windows.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-osx.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-linux.jar
net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar
net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar
net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar
tv/twitch/twitch/6.5/twitch-6.5.jar
tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-windows-64.jar
tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-osx.jar
tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-windows-32.jar
tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-64.jar
tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-32.jar
  • Related