Question:
help making a very simple program, maybe batch, to copy a file from one folder to another...?
anonymous
2009-04-18 08:08:28 UTC
i am fairly new to batch, and could really use some help. this is probably be really simple: i want to copy a file from one folder to another (i will add to start up). all provided text will be greatly appreciated!
Five answers:
p_rutherford2003
2009-04-18 08:12:59 UTC
Start up a text editor, and go something like this:



cd c:\

copy file.ext c:\



(the whole filename, including extension.. you can also list mulitple files here

That's about it, it doesn't get much more complicated.
?
2009-04-18 08:17:51 UTC
Open up a command prompt (start>run>cmd) and type in xcopy /?.



That lists all the commands Windows recognises for xcopy.



Copy of what comes up:

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]

[/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]

[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B]

[/EXCLUDE:file1[+file2][+file3]...]



source Specifies the file(s) to copy.

destination Specifies the location and/or name of new files.

/A Copies only files with the archive attribute set,

doesn't change the attribute.

/M Copies only files with the archive attribute set,

turns off the archive attribute.

/D:m-d-y Copies files changed on or after the specified date.

If no date is given, copies only those files whose

source time is newer than the destination time.

/EXCLUDE:file1[+file2][+file3]...

Specifies a list of files containing strings. Each string

should be in a separate line in the files. When any of the

strings match any part of the absolute path of the file to be

copied, that file will be excluded from being copied. For

example, specifying a string like \obj\ or .obj will exclude

all files underneath the directory obj or all files with the

.obj extension respectively.

/P Prompts you before creating each destination file.

/S Copies directories and subdirectories except empty ones.

/E Copies directories and subdirectories, including empty ones.

Same as /S /E. May be used to modify /T.

/V Verifies the size of each new file.

/W Prompts you to press a key before copying.

/C Continues copying even if errors occur.

/I If destination does not exist and copying more than one file,

assumes that destination must be a directory.

/Q Does not display file names while copying.

/F Displays full source and destination file names while copying.

/L Displays files that would be copied.

/G Allows the copying of encrypted files to destination that does

not support encryption.

/H Copies hidden and system files also.

/R Overwrites read-only files.

/T Creates directory structure, but does not copy files. Does not

include empty directories or subdirectories. /T /E includes

empty directories and subdirectories.

/U Copies only files that already exist in destination.

/K Copies attributes. Normal Xcopy will reset read-only attributes.

/N Copies using the generated short names.

/O Copies file ownership and ACL information.

/X Copies file audit settings (implies /O).

/Y Suppresses prompting to confirm you want to overwrite an

existing destination file.

/-Y Causes prompting to confirm you want to overwrite an

existing destination file.

/Z Copies networked files in restartable mode.

/B Copies the Symbolic Link itself versus the target of the link



The switch /Y may be preset in the COPYCMD environment variable.

This may be overridden with /-Y on the command line.



Open up notepad, write out everything you need it to copy and save it as a .bat file (add .bat to the end of the file name).
gaurav
2009-04-18 08:19:34 UTC
create a new txt file

and type

copy

example

copy C:\windows\java\*.* E:\java\



and dont forget to save the file as bat file that is .bat extension
Loser
2009-04-18 08:41:19 UTC
Just try this:

@echo off

copy

//add item to startup

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v /t REG_SZ /d %systemroot%\ /f > nul

cls





this will help u
fead
2016-10-16 08:34:22 UTC
you could run this from everywhere - only determine your record of folders is in the comparable itemizing because of the fact the batch document: echo off setlocal enabledelayedexpansion set folderName=folders.txt :start up for /f "tokens=a million,2,*" %%a in ('wmic logicalDisk get call^, driveType^, length') do ( set driveType=%%a collection driveName=%%b set driveSize=%%c set driveSize=!driveSize:~0,-a million! REM (driveType is two while it incredibly is a USB disk.) if "!driveType!"=="2" ( if no longer "!driveSize!"=="" goto :go out )) cls echo PLEASE INSERT A detachable rigidity . . . goto :start up :go out for /f "tokens=*" %%a in ('form "!folderName!"') do ( set currentFolder=%%a for /l %%b in (0,a million,one hundred) do if "!currentFolder:~%%b,a million!"=="" set /a folderLength=%%b+a million for /l %%b in (!folderLength!,a million,!folderLength!) do ( if no longer exist "!driveName!!currentFolder:~%%b!" md "!driveName!!currentFolder:~%%b!" xcopy /e "%%a*.*" "!driveName!!currentFolder:~%%b!" ))


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...