abbodi1406 / KMS_VL_ALL_AIO

Smart Activation Script
GNU General Public License v3.0
8.13k stars 1.08k forks source link

Batch file parsing bugs #8

Closed cleanremote closed 2 years ago

cleanremote commented 3 years ago
  1. If there is a file called echo (without an extension) in the current working directory, and run KMS_VL_ALL_AIO, CMD will fail at the echo. command: image
  2. If the name of the KMS_VL_ALL_AIO script contains a resolvable variable, such as KMS_VL_ALL_AIO%os%.cmd, and run the script unelevated, it will try to run a file called KMS_VL_ALL_AIOWindows_NT.cmd instead.
cleanremote commented 3 years ago
  1. If CMD's command extensions are disabled (cmd /e:off), KMS_VL_ALL_AIO will fail:
    C:\>KMS_VL_ALL_AIO.cmd
    The syntax of the command is incorrect.
    AMD64==AMD64 was unexpected at this time.
abbodi1406 commented 3 years ago

Why assuming bug-intended scenarios? do you normally have those conditions? :)

aelfwine88 commented 3 years ago
  1. The reason I use echo: instead of echo. in my batches is that if I (or other batch file) accidentally echos out into a file called echo that will throw this error. It should be a pretty easy replace/fix.

@cleanremote:

  1. So if one somehow renames the file it may not run properly, like KMS_VL_ALL_AIO.txt it wont run at all. I would be interested in a real world scenario where this might occur without intend. Also what should be the proposed fix?

  2. I would be interested in a real world scenario where this might occur without intend. Also what should be the proposed fix?

cleanremote commented 3 years ago
  1. I think echo/ is better than echo:
  2. The part of KMS_VL_ALL_AIO where it tries to elevate itself has a bug where it doesn't escape percent symbols in the script's filename, so any resolvable variables would erroneously expand themselves.
  3. The second line of KMS_VL_AIO should say @setlocal EnableExtensions DisableDelayedExpansion
aelfwine88 commented 3 years ago
  1. Interesting. Turns out echo( should be the best version.
abbodi1406 commented 3 years ago

If CMD's command extensions are disabled, it's either the user aware of that, or his OS is messed-up

i actually already know about echo( thing being the best, but regular echo is still valid in normal real scenarios :)

Macleykun commented 2 years ago

Idm making a pull to make all echo. into echo(. But depends if @abbodi1406 wants this. If not that i suggest this issue can be closed.

abbodi1406 commented 2 years ago

I'm not into it even Notepad3 and Notepad++ don't like orphaned ( :)

Macleykun commented 2 years ago

Great, then this issue can be closed :)

Macleykun commented 2 years ago

@cleanremote @abbodi1406 this issue can also be closed.