I am trying to check if a folder has been created IF NOT create the folder
IF NOT EXIST dist\\js (MKDIR dist\\js)
then regardless if it did or did not create the folder i want to run
& uglifyjs dev/*.js -m -o dist/js/app.js
now it seems that the & is not working. The second command is not executed if the folder exists.
If i use the following as my first statement:
IF NOT EXIST dist\\js (MKDIR dist\\js) ELSE (Echo exist)
the first time around I run the two together as in:
IF NOT EXIST dist\\js (MKDIR dist\\js) ELSE (Echo hate) & echo Love & uglifyjs dev/*.js -m -o dist/js/app.js
The folder gets created BUT the app.js file is not created. Only when i run the command again it does create the app.js file.
Now how would i preferably check if theres a folder and then regardless continue with the next command.
(IF NOT EXIST dist\\js (MKDIR dist\\js) ELSE (Echo hate)) & echo Love & uglifyjs dev/*.js -m -o dist/js/app.js
Parentheses enclose all the code before the & to make it operate as 1 complete condition.
Once the condition is done, then the code after the & will execute regardless
of the result of the previous condition.
The doubling up of backslashs are not needed for paths in batch-file as escapes such as \n for newline are not a part of the batch-file language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With