Home > Blockchain >  Is there a variable for the file you open the CMD file with?
Is there a variable for the file you open the CMD file with?

Time:06-16

My CMD file: java -jar unluac.jar unluac.lua > unluac_decompiled.lua

So in my CMD file, I have to manually change the name of the file I want unluac(.jar) to decompile. Now what I want is to be able to say something like this:

java -jar unluac.jar [var].lua > [var]_decompiled.lua where VAR would be the file i drag onto the CMD file.

enter image description here

CodePudding user response:

When you drag-and-drop a file onto one with a cmd extension, the name of the dropped file is passed as the first parameter. So, assuming this will always be files with an "lua" extension, you could do:

@echo off
java -jar unluac.jar %1 > %~n1%_dec.%~x1%
  • Related