I have 4 folders, with A being the parent, B and C being the child of A, and D being the child of C.
A -> B
A -> C -> D
In folder B I want to generate a build via NPM and then to move the new folder over to D after deleting the previous version.
So to do this I'm trying to run the following script in the command line:
react-scripts build && rd /s/q ../C/D && move build ../C/D
Upon running this command however, I receive the following error:
Parameter format not correct - "C".
What is causing this error in particular and what would be the proper syntax to run this command?
CodePudding user response:
Windows cmd prompt often requires paths to be in double quotes.
C:\Users\Me>mkdir c/d
The syntax of the command is incorrect.
C:\Users\Me>mkdir "c/d"
Windows powershell will accept the paths without quotes.
PS C:\Users\Gordon> mkdir c/d
Directory: C:\Users\Me\c
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 7/20/2022 11:51 AM d
CodePudding user response:
In your example, just swap / (forward slash) with \ (backward slash) and you would probably be good to go...
react-scripts build && rd \s\q ..\C\D && move build ..\C\D
If your folder or file has empty spaces in the name you'd want to surround it with quotes.