Raoul90 Posted January 8, 2009 Share Posted January 8, 2009 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.dllAnd 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! Link to comment Share on other sites More sharing options...
KingAFW Posted January 8, 2009 Share Posted January 8, 2009 (edited) @echo offregsvr32 /s %SystemRoot%\system32\File.dllmove c:\filename %SystemRoot%\system32If I understood you correctly Edited January 8, 2009 by KingAFW Link to comment Share on other sites More sharing options...
Raoul90 Posted January 10, 2009 Author Share Posted January 10, 2009 (edited) 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 January 10, 2009 by Raoul90 Link to comment Share on other sites More sharing options...
Geej Posted January 10, 2009 Share Posted January 10, 2009 (edited) Q1: (force delete a file, assuming it is not locked by any process)General synatx isdel /F /Q yourfile.txtThe 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 thisdel /F /Q "%systemdrive%\myfiles\yourfile.txt"See del /? for help in cmdboxQ2: Copy filesSyntaxmd "%systemdrive%\myfiles" <----assuming systemdrive is C:\copy /Y *.* "%systemdrive%\myfiles" <--- assuming u call the cmd file in <CDdrive>\myfiles directoryOpen cmdbox, see copy /? and set (view environment variable) for more detailsNOTE: if u want to copy files & subdir in myfiles folder, use xcopySee xcopy /? for syntaxCommand-line reference A-Z Edited January 10, 2009 by Geej Link to comment Share on other sites More sharing options...
Raoul90 Posted January 10, 2009 Author Share Posted January 10, 2009 (edited) 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 January 10, 2009 by Raoul90 Link to comment Share on other sites More sharing options...
Geej Posted January 10, 2009 Share Posted January 10, 2009 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.cmdcd myfilescopy /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 More sharing options...
Raoul90 Posted January 10, 2009 Author Share Posted January 10, 2009 I dont get it 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.docMaybee you could be a bit more specific to me what to type into the cmd?Thank you. Link to comment Share on other sites More sharing options...
Geej Posted January 11, 2009 Share Posted January 11, 2009 (edited) 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.docand u want to copy all .doc to C:\cd autoplay\docs\myfilescopy /Y *.doc C:\The first command will navigate to the AutoPlay\Docs\Myfiles folder, thenThe 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 becd autoplay\docs\myfilescopy /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\myfilesOtherwise 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 January 14, 2009 by Yzöwl Codebox's changed to save screen real estate Link to comment Share on other sites More sharing options...
Raoul90 Posted January 14, 2009 Author Share Posted January 14, 2009 (edited) Geej, thanks dude.I got it working.Thanks for the explanation. The first one with CD works perfectly. Edited January 14, 2009 by Raoul90 Link to comment Share on other sites More sharing options...
Geej Posted January 15, 2009 Share Posted January 15, 2009 Glad it works for u Link to comment Share on other sites More sharing options...
jaclaz Posted January 15, 2009 Share Posted January 15, 2009 Just for the record, the /Y switch for the copy command is NOT needed from batch:http://www.ss64.com/nt/copy.htmlNT 4 will overwrite destination files without any prompt, Windows 2000 and above will prompt unless the COPY command is being executed from within a batch script.jaclaz Link to comment Share on other sites More sharing options...
Geej Posted January 15, 2009 Share Posted January 15, 2009 Thanks jaclaz for the extra info. Indeed it is.I think can reduce to 1 single command: (instead of 2 command lines)copy autoplay\docs\myfiles\*.doc C:\ Link to comment Share on other sites More sharing options...
jaclaz Posted January 15, 2009 Share Posted January 15, 2009 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.htmlhttp://www.ss64.com/nt/popd.htmlPUSHD E:\autoplay\docs\myfiles & copy *.doc C:\ & POPDjaclaz Link to comment Share on other sites More sharing options...
Raoul90 Posted January 18, 2009 Author Share Posted January 18, 2009 (edited) 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 January 18, 2009 by Raoul90 Link to comment Share on other sites More sharing options...
jaclaz Posted January 18, 2009 Share Posted January 18, 2009 Read this:http://www.ss64.com/nt/xcopy.htmlYou need to specify the name of both the source and target folders as in the given example:To copy a folder:XCOPY C:\utils D:\Backup\utils /iTo copy a folder including all subfolders.XCOPY C:\utils\* D:\Backup\utils /s /iadding if needed the /E switchjaclaz Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now