Jump to content

Two Question About CMD/Batch


Recommended Posts

Hi,

Can someone tell me the commands to do the following in a CMD or batch:

I want to do the following with a cmd:

regsvr32 /s %SystemRoot%\system32\File.dll

And i also want to know how to move a file:

I have a file at the local disc, (C:/) and i want it be moved to WINDOWS/system32.

How can i do that?

Thanks in advance! :thumbup

Link to comment
Share on other sites


Yup that works.

Thank you! :)

Another 2 questions:

1:

How can i force delete a file with CMD?

2:

Im currently bissy creating my own office 2003 cd with all updates and stuff.

Now i will put some files i need in the image (which will be burned to a cd).

I got the image Office2003SP3NL.iso, in this image i got a directory called "myfiles".

I will burn this image to a cd.

What i want:

I want a cmd that copies all files in the "myfiles" directory(1), and it should copy them to my C:/ (local disk).

(1): "myfiles" directory is on the burned cd, so when its in the dvd-reader, and when i call the cmd it should start copying those file to C:/

How should my CMD look like?

Btw:

The CMD i also in the "myfiles" directory.

Thanks in advance! :)

Edited by Raoul90
Link to comment
Share on other sites

Q1: (force delete a file, assuming it is not locked by any process)

General synatx is

del /F /Q yourfile.txt

The above syntax assuming you are deleting in current directory. If your .cmd file is not in current directory and it is in different path, just provide the full path to delete the file, maybe like this

del /F /Q "%systemdrive%\myfiles\yourfile.txt"

See del /? for help in cmdbox

Q2: Copy files

Syntax

md "%systemdrive%\myfiles" <----assuming systemdrive is C:\

copy /Y *.* "%systemdrive%\myfiles" <--- assuming u call the cmd file in <CDdrive>\myfiles directory

Open cmdbox, see copy /? and set (view environment variable) for more details

NOTE: if u want to copy files & subdir in myfiles folder, use xcopy

See xcopy /? for syntax

Command-line reference A-Z

Edited by Geej
Link to comment
Share on other sites

The Delete thing works fine.

Thanks.

But i don't get the copying stuff.

I have got a "prepared image" (i only need to make it an image).

The prepared image contains all stuff including the "myfiles" directory.

In this "myfiles" directory i want a cmd that copies al items to C:/

In the "myfiles" directory there are no subfolders, just files .doc etc.

So when i burned the image and i go to "My Computer" and explore the cd then i go in the "myfiles" folder and i click the copy.cmd, then it should start copying the files inside the "myfiles" folder and the cmd should paste them at my %systemdrive%.

The CD-Drive Letter is never the same, also the %systemdrive% could be other then C:/.

edit:

Should it be something like this:

copy myfiles/example.doc %systemdrive%

?

When i put this in a cmd and start it from the root of the cd, is that gonna work?

Edited by Raoul90
Link to comment
Share on other sites

Assuming copy1.cmd (avoid copy.cmd as it is similiar to cmd internal command copy) is at root CD and myfiles folder is only 1 level deep, then try something like this within copy1.cmd

cd myfiles

copy /Y *.doc C:\

What this means is that copy1.cmd is lauch from root of CD, it will navigate 1 level folder to myfiles folder.

Copy all of .doc files to C:\. I'm using absolute path, rather than relative one. Feel free to change to relative path if u have to.

Link to comment
Share on other sites

I dont get it :P Im new with those commands so.

Clear things up a bit.

I am making an autoplay using AutoPlay Media Studio. I also have a button to call the cmd which copies the items from the Myfiles directory.

When i make the autoplay the files which should be copied are in:

CD\AutoPlay\Docs\Myfiles\files.doc

Maybee you could be a bit more specific to me what to type into the cmd?

Thank you. :)

Link to comment
Share on other sites

Assumption : copy1.cmd is on your CD root and Drive E is your optical drive,

the full path to your .doc on your CD is E:\autoplay\docs\myfiles\files.doc

and u want to copy all .doc to C:\

cd autoplay\docs\myfiles
copy /Y *.doc C:\

The first command will navigate to the AutoPlay\Docs\Myfiles folder, then

The 2nd command will copy all .doc to C:\

U can also replace 2nd command as

copy /Y *.doc "%systemdrive%\"

To made things clearer, so your code can also be

cd autoplay\docs\myfiles
copy /Y *.doc "%systemdrive%\"

U mention "also the %systemdrive% could be other then C:/' which means u can only specific absolute drive letter if u wish to copy to D: , E: etc (other than %systemdrive%, which is usually C:)

*cd in my 1st command means change directory (DOS command). It is not a folder named CD (just to make it clearer)

If it is not correct assumption, then probably 1st command will be

cd cd\autoplay\docs\myfiles

Otherwise pls provide the full path to your .doc , including optical drive letter so that I can provide the correct command.

I hope u understand that to suggest a proper code that works for you, u need to be very specific in stating your full path that is on your CD.

Hope that helps.

Edited by Yzöwl
Codebox's changed to save screen real estate
Link to comment
Share on other sites

I think can reduce to 1 single command: (instead of 2 command lines)

copy autoplay\docs\myfiles\*.doc C:\

Again, just for the record, you can also use the & operator and the PUSHD and POPD commands (though unneeded in this specific case):

http://www.ss64.com/nt/pushd.html

http://www.ss64.com/nt/popd.html

PUSHD E:\autoplay\docs\myfiles & copy *.doc C:\ & POPD

jaclaz

Link to comment
Share on other sites

One more question:

How can i copy a whole map/folder/ directory from the autoplay\docs\myfiles folder?

I have a map called "Pictures" and i want the whole directory to be copied so not only the files inside.

Edited by Raoul90
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...