S
S
simakmak2015-10-20 11:25:45
Backup
simakmak, 2015-10-20 11:25:45

Fast copy via CMD, back and forth, is it possible?

There was recently an idea of ​​copying files through bat files. Since at work, before installing Windows, we usually copy the entire User folder (without much bother), I wrote a simple script to make my life easier.
XCOPY %HOMEDRIVE%\Users \\DC\Share\Backup\%COMPUTERNAME% /s /c /y /I echo
- Everything was successfully copied to the %COMPUTERNAME% folder
network to the backup folder, a folder with the name of the computer is automatically created in it, and all directories and files are merged there, except for system and hidden ones.
Since only yesterday morning I started to deal with CMD, the following questions appeared, but how to make life easier)
Therefore, it was decided to add a batch file with a menu for restoring files, back to the user's desktop, when there will be a clean Windows for the user with all programs. But the question arose of how to make the batch file understand what to copy back (that is, which folder, from which computer), and the idea arose that the menu would pop up in batch files, with folders from computers from the Backup folder, and by pressing a number ( preferably) or entering a specific folder, the batch file picked it up and already copied it). I hope you understand me) I would be grateful if you hint how to do this)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2015-10-20
@yellowmew

Do you have more than one user working on the same computer?
Why do you need to copy everything from users at all if you only need files of a certain user
Use the %username% (%%username%% in scripts) substitution in the command line and upload / take a backup share by username.
How it was done (without using easy transfer or migration wizard) in one of my places :
on server server created a share with the following rights :
access from the network : everyone - full
NTFS rights : Everyone - create folders, write data only for this folders.
NTFS rights: Domain Admins - full for folder, subfolders and files
NTFS rights: Creator-Owner - full for subfolders and files.
The script was run as a user, took the contents of the c:\users\%username% folders with the filter "*,doc","*.docx","*.xls","*.xslx" and so on, as it pleases.
The folder \\server\share\%username% was created - the user has the rights to create folders, thanks to everyone, then the created folder thanks to the creator-owner is available only to him and domain administrators.
When restoring, the same standard path \\server\share\%username% was again used - each user could pick up files only from his own folder.
Accordingly, the same script was used to migrate any user, without options, extra files and other nonsense.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question