0

I tried something like this in cmd

md mainfolder/{subfolder1, subfolder2}
touch folder/{file1, file2}.js

and got this error

Missing argument in parameter list.

  • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
  • FullyQualifiedErrorId : MissingArgument

I think the {...} syntax is from linux.

So what is the equivalent syntax in cmd?

kr17
  • 51
  • 1
  • 7

2 Answers2

1

Just use

md mainfolder\subfolder1 mainfolder\subfolder2

md takes arguments separated by space. Each argument is a directory path.

Note: md also creates parent directory if it does not exist

md utils\downloads\Editor 

is the same as:

MD utils 
MD utils\downloads 
MD utils\downloads\Editor

Source: https://ss64.com/nt/md.html

To create files see - How to create empty text file from a batch file?

Ravi Kumar Gupta
  • 1,698
  • 2
  • 22
  • 38
  • @lit my bad there.. because of my habit of working on linux/mac, I used forward slashes. I will update my answer. – Ravi Kumar Gupta Jan 07 '19 at 03:28
  • 1
    @RaviKumarGupta - Thank you for updating the answer. It is a best practice to always quote paths and filenames. It will save time, frustration, money later. – lit Jan 07 '19 at 13:06
0

For the 2nd part of the question, Windows doesn't come with a touch tool.
See also this Q&A

To invoke a command on a list of items use the for loop:

for %%A in (file1 file2) do break>"%%A.js"

Where break> will create a zero length file (or overwrite it).

For a more concise emulation of the touch command either use a windows port or
see MC NDs answer in the mentioned question

  • I can agree that this will work, but it seems more obvious to use `TYPE NUL>"%%A.js"`. – lit Jan 06 '19 at 21:36