-1

here's the code;

::set var output dir
SET outputdir= %~dp0output

::user define the file path
set /p decrypt= Enter File Path: 

::then we move the file from "%decrypt%" to "%ouputdir%"="/output"
move /Y %decrypt% %outputdir%

Result; The syntax of the command is incorrect.

I don't know what i do/did wrong but i would like to know any fix to this ty <3

Devsology
  • 11
  • 1
  • 2
  • 2
    Do either `%decrypt%` or `%outputdir%` have spaces in them? If so, you need to put quotes around them. – SomethingDark Jun 07 '22 at 04:35
  • Please read [Why is no string output with 'echo %var%' after using 'set var = text' on command line?](https://stackoverflow.com/a/26388460/3074564) There is at least `outputdir` defined wrong as there is a space right to the equal sign which must be removed to be able to reference the value of `outputdir` enclosing it in `"`. So correct would be `set "outputdir=%~dp0output\"` and `set /P "decrypt=Enter file path: "` and finally `move /Y "%decrypt:"=%" "%outputdir%"`. – Mofi Jun 07 '22 at 06:39
  • Please note further that `::` is an invalid label and not really the correct syntax for a remark (comment) which are defined with command `rem` in a batch file. Run in a command prompt window `rem /?` for help on the remark command. – Mofi Jun 07 '22 at 06:40

1 Answers1

0
move /Y "%decrypt%" "%outputdir%"

without knowing exactly what your response was to the two prompts, this would be a guess. If either of the directory names you entered contained eg. spaces then cmd will treat that name as multiple parameters. Quoting the names tells cmd that the name actually contains spaces.

Magoo
  • 77,302
  • 8
  • 62
  • 84
  • *i tried removing the ' " ' characters but didnt do anything* here's the only output i get; Enter File Path: "C:\Users\user\Desktop\test\lol.png" The syntax of the command is incorrect. Press any key to continue . . . if you have any socials that i can send you the full code of it you can send it to me here :) – Devsology Jun 08 '22 at 02:40