- Windows copy command syntax and examples
- Copy the contents of a file to another file
- Copy file to another directory
- Copy files with white space in name
- Copy multiple files
- Use of environment variables
- How to Copy Path of a File or Folder in Windows 10
- Copy Path of a File or Folder in Windows 10
- Windows Tips: Copy a File Path, Show or Hide Extensions
- How to Show or Hide File Extensions
- How do you automate copying file with path too deep issues in Windows?
- 5 Answers 5
- How to move folder/files with path names > 255 characters in Windows 8.1? [closed]
- How can you copy/move a folder or file with path name length > 255 on windows?
- 2 Answers 2
- Robocopy
- Not the answer you’re looking for? Browse other questions tagged file copy windows-8.1 directory move or ask your own question.
- Linked
- Related
- Hot Network Questions
Windows copy command syntax and examples
Using copy command, we can copy files from one directory to another directory. This command is similar to the Linux cp command, but it does not match with the full functionality of cp. Windows copy command can be used to copy files only, we can’t copy directories.
The syntax and usecases of copy command are explained below with examples.
Copy the contents of a file to another file
Example: To copy a file from c:\data\file1.doc to D:\backup\file2.doc
If the destination file already exists you will be prompted for confirmation. To suppress this confirmation you can use /Y switch with copy command. This would be useful if you are executing copy command from a batch file.
If the destination file exists, the above command will overwrite the same without asking the user for confirmation.
Copy file to another directory
When we specify a directory path as the destination, the files will be copied with the same name. We can assign a different name by specifying the new name in the destination path. Example is shown below.
To copy the file 1.doc loated at c:\data\documents to the directory c:\data\newdocs
Copy files with white space in name
If the file name has white space within it, we can wrap up the name in double quotes.
Example: To copy file, my resume.doc to another folder
Copy multiple files
We can’t specify multiple file names in copy command. However, we can use wildcards to identify a group of files and then copy all of them in a single command.
For example, to copy all excel files from current folder to another folder F:\backup
To copy all files in current folder to another folder
Use of environment variables
We can use environment variables in the copy command to specify the path of the folders. Like USERPROFILE, SystemRoot, ProgramFiles, TEMP, WINDIR, APPDATA, HOMEPATH.
For example, to copy a file to a user’s documents folder
The above command copies the file to the My Documents folder of the current logged in user.
You may also want to read
Windows «copy» is funny. Type «copy 1 2» and the file «1» will be copied into a new file «2». Now separate them by a plus sign instead of a space (copy 1+2) and you’ll concatenate 1 and 2 and replace the old file «1» with the result of the concatenation!
Yes, we can concatenate two or more files using copy command. You need to separate the list of files using +. You can redirect the resultant data to a new file also.
The above command will not alter the file 1. It creates a new file 3 with the concatenated data of 1 & 2. If no file name is provided it stores the result in the first file.
My Win7 cannot find a copy command, and when i run xcopy, a window flashes and exits.
I have the same problem. If you solved it, could you please explain how?
If you can not find your copy.exe file, you can download it to your windows directory or C:\ Directory depending the setting on your OS you should also be able to copy and run it from system32 or system folder.
how can i combine 2 .exe files and be able to use both after concatenation
I want to copy 2 different files(.exe,.config) from source to destination server of windows.
can you please help me on this command.
Hello i have a problem with my cmd windows 7.when i try to copy a command. Like help > file.pdf. i mean in extension pdf because i have this problem only with .pdf extension but not with .txt.So whe i execute the command. No problem. Then when i go to open the file.pdf ftom user destination the file.pdf doesn’t open say that is corrupted.please do help me .thanks
i have a file contain many lines as sources and another file has the same numbre of lines as destinations. i want to copy first line as source( c:/test/*.txt) to first line in destination ( d:/test2/), secend line ( c:/test/*.pdf) to second line in destination ( E:/test3/)……
Can I use the DOS/Windows “COPY” command in a BAT file to copy a file or a short string of text to computer memory and then paste (Ctrl +V) that string or file into a document?
How to Copy Path of a File or Folder in Windows 10
Retrieving a path of a certain file or folder is always a tedious task. Windows 10 has an option called Copy Path which is very much helpful when you prefer to know the full path of the selected items to the clipboard. These items can be files or folders that are deeply rooted in your File Explorer, and so you wanted to stay away from the annoying traverse to the location or manually copy the path from the address bar. So, in this article we will guide you with steps to Copy Path of a File or Folder in Windows 10.
In the previous editions, the right click context menu of any file or folder gives you copy path command but Windows 10 provides you a button of copy path in the Home tab ribbon area. The path gets copied to the clipboard and then you can easily paste it to your desired location. So, let us go to the steps and see how to Copy Path of a File or Folder in Windows 10.
Copy Path of a File or Folder in Windows 10
- Get into the File Explorer and navigate yourself to the location whose path you prefer to copy.
- Make a click on the file or folder and on the Home tab ribbon you can see a Copy path button.
- Click on the Copy path button and your file or folder’s path will be copied.
- Now, simply paste the path in your desired text editor and the path gets copied.
- Its’ that simple.
Make your work easier with the new features of this version of OS. Copy Path of a File or Folder in Windows 10 and use it in any desired way. Give it a shot and let us know how it worked out.
Windows Tips: Copy a File Path, Show or Hide Extensions
Today’s Best Tech Deals
Picked by PCWorld’s Editors
Top Deals On Great Products
Picked by Techconnect’s Editors
You know those times when you want to upload a new photo to, say, Facebook or Pinterest? The typical browser-based upload tool forces you to click through countless folders until you find the one you want. It’s a slow and often maddening dance.
Fortunately, there’s an easier way.
If you already have the photo open in Explorer, you can copy its file path to the clipboard, then paste that path into the upload dialog box. Here’s how:
- Open Windows Explorer and find the photo (or document) in question.
- Hold down the Shift key, then right-click the photo.
- In the context menu that appears, find and click Copy as path. This copies the file location to the clipboard. (FYI, if you don’t hold down Shift when you right-click, the Copy as path option won’t appear.)
- Now, in your browser, head to Facebook or wherever, access the upload tool, and click Browse.
- Press Ctrl-V to paste in the file location, then click OK.
Windows
That’s all there is to it! No hunting through a bunch of folders to find the file you want—just paste the path and you’re done.
I must give credit where credit is due; I first heard about this clever tip from Windows guru Ed Bott. But it’s too great not to share; once you start using it, you’ll wonder how you got along without it.
How to Show or Hide File Extensions
Recently I’ve been downloading some audiobooks in MP3 format. I wanted to import them into iTunes for listening on the go, but there’s one problem: iTunes (and, more importantly, my iPhone) can’t bookmark an MP3 file. Thus, in between listening sessions, it’ll be difficult for me to resume my book from where I left off.
iTunes can, however, bookmark its own audiobook files. So if I convert my MP3s to Apple’s AAC format, then change the file extension so iTunes thinks they’re audiobooks, I’m good to go.
The first part is easy. In iTunes, just right-click the MP3 and choose Create AAC Version. That will eventually produce an audio file with an m4a extension. But I need to change that to m4b, the extension iTunes recognizes as an audiobook.
I had no problem finding the file in Windows Explorer—but the file extension was missing! Or, more accurately, hidden. That’s the default setting in Windows nowadays, the idea being to keep you from monkeying with files and causing system problems.
This kind of monkeying, however, is harmless. I just needed to un-hide the extensions. Here’s how:
- In Windows 7 (and, I think, Vista), click Start, then type extension.
- Click Show or hide file extensions.
- In the Folder Options box that appears, clear the check box next to Hide extensions for known file types, then click OK.
Windows
That’s it! Now you should see extensions for most common files. And in my case, changing that audio file’s extension was as easy as right-clicking it and choosing Rename.
If you want to hide the extensions again after you’re done, just repeat the process and re-check the box mentioned in Step 3.
How do you automate copying file with path too deep issues in Windows?
I want to be able to selectively copy a list of files and preserve their directory structure. The problem is that there are quite a few files that their path exceeds 256 character. How is this problem usually handled?
Edit: I should make it clear that I only want to selectively copy files, not folders. I don’t think robocopy can be efficiently used to copy an individual file and it’s folder structure effectively.
5 Answers 5
I wrote a VBscript that checks path length and calls subst , as soon as a certain threshold is reached. These calls are stacked on each other so that in the middle of a recursion, this layout exists:
This way with each level of subst, a shorter path is generated. It also means, that you must copy your folders sequentially, to be able check for long paths before you issue the copy command.
Once all files in a folder are copied, the recursion does jump back one level ( subst /d ), freeing up one drive letter.
Using 4-5 drive letters, that subst each other when the path gets to deep I had been able to copy paths that had lengths waaaaay over the MAX_PATH limit.
This describes the general procedure of doing it with subst. How you do it depends on your needs, I always used that little subst trick in a minimal, «solves this single problem» way.
For example, copying to an equally deep target path means you need another stack of subst’ed drive letters.
Unpacking all .zip files within a single, deeply nested directory structure may require only on stack, but you need to shorten the threshold a bit to account for folders in the .zip, etc.
How to move folder/files with path names > 255 characters in Windows 8.1? [closed]
Want to improve this question? Update the question so it’s on-topic for Stack Overflow.
Closed 4 years ago .
How can you copy/move a folder or file with path name length > 255 on windows?
I have looked around for ages, and the only possible way I have found is to use the subst method. I wish I didn’t have to mess about with this. I simply want to copy/move a file or directory, X , to location Y .
I’m fine with making a .bat script, or other kinds of scripts to achieve this.
PS: this is marked as of topic, which I’m fine with, but it was being done in a programming context.
2 Answers 2
I finally found a good solution!
Robocopy
Robocopy supports path names > 256 by default, and even provides a flag that lets you turn OFF support for long path names (flag: /256 ).
Example usage of Robocopy:
robocopy /E C:/path/with/very/long/names/in/it C:/new/path
Not Windows 8 but in Windows 7, 64bit, I have the same problem and I just discovered that while nothing else worked, I was able to cut and paste folders containing files with path names that were too long into a destination folder with a shorter path. That is, in Explorer.exe, I selected a directory that I couldn’t delete because some files had path names that were too long, then CTRL-X to cut it and paste it into another explorer window (CTRL-V).
Not the answer you’re looking for? Browse other questions tagged file copy windows-8.1 directory move or ask your own question.
Linked
Related
Hot Network Questions
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.