Discussion Locked

CMD HELP

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I want to create few folders along with some files inside it.

Is it possible to create a folder with files in a single command of CMD?

Thx in advance :)

7 replies

by nicknielsen

Create a batch file with all the appropriate MD and COPY/MOVE commands in it.

Otherwise, it can't be done. You will need to type out each individual command.

by lookshankar

Have you used Ruby on Rails or smfony(PHP framework) , in that we can create several folders and files using a single command like 'CMD>>rails Nick'.It will a new project/application with a name Nick.So here I'm trying to do something like that.

by nimmo

I'm not sure if this is what you are after but you can use a amphersand(&) to string commands together.

by nicknielsen

This type of command works because the directory structure is defined in the program RAILS. No such command exists in the CMD environment unless you create it yourself.

So if you want to create a home folder with two directories and copy a default file into that you would need four commands, like so:

MD newuser
MD newuser\mail
MD newuser\profile
COPY d:\path\default.file newuser\profile

To do this in a script or batch file titled CREATE.BAT, substitute as follows

MD %%1
MD %%1\mail
MD %%1\profile
COPY d:\path\default.file %%1\profile

To invoke this file, you would enter:

CREATE [i]newuser[/i]

This is very simplistic, does not check for entry errors or pre-existing directories, and may contain errors itself. But this type of file is the only way you can use a single command to create directories and copy files from the CMD prompt.

by lookshankar

Nimmo,

That was a good idea for merging two commands I think, but not sure.Here what I need is the Folders with some files should be created using CMD window in a single command.

for eg :
CMD>>ruby myapp ,this command in Ruby on rails (programming language) will create certain folders and files.So similarly I would like to do.

Anyhow your Idea was helpful to me Nimmo.Thanks for your reply.

by lookshankar

NickNielsen,

You've given a very useful/helpful explanation for doing so.Thank you for your help friend.

This discussion is closed to new replies.