Team OS : Your Only Destination To Custom OS !!

Welcome to TeamOS Community, Register or Login to the Community to Download Torrents, Get Access to Shoutbox, Post Replies, Use Search Engine and many more features. Register Today!

Locked [Help] batch script

Status
Not open for further replies.

Ninetailedfox

Member
Downloaded
77.7 GB
Uploaded
296.2 GB
Ratio
3.81
Seedbonus
5,557
Upload Count
0 (0)
Member for 8 years
how can I put this or make a batch script this mklink command: mklink /d "C:\Users\[USER]\AppData\Roaming" "D:\Backup\[folder I want to backup"
 

andribrasil

Member
Downloaded
0 bytes
Uploaded
6.8 GB
Ratio
-
Seedbonus
5
Upload Count
0 (0)
Member for 3 years
you need mkdir, not mklink
@echo on
mkdir "D:\Backup\folder I want to backup"
xcopy "C:\Users\%USERNAME%\AppData\Roaming\*.*" "D:\Backup\folder I want to backup" /y /e /s /d
exit
 

Cyler

šŸ¤“ Super Admin
āš”OS Master
Downloaded
510.5 GB
Uploaded
24.8 TB
Ratio
49.66
Seedbonus
27,960
Upload Count
1 (1)
Member for 7 years
you need mkdir, not mklink
@echo on
mkdir "D:\Backup\folder I want to backup"
xcopy "C:\Users\%USERNAME%\AppData\Roaming\*.*" "D:\Backup\folder I want to backup" /y /e /s /d
exit
Technically speaking, you dont need mkdir with xcopy. Xcopy will prompt to create the folder if it's missing or use /i to avoid prompt.

@Ninetailedfox
Not sure what you want to achieve by using Mklink. That is a one-time command, used to create a link or a redirect if you like, between two locations (folders in your case), and even tho you can use it in a batch script, there isn't much sense in doing so. The destination folder must exist prior to creating a link, and the data should already be on the destination folder.
The reason MkLink exists is in case you have software that can only work on a specific disk, to be able to make it work on any other disk.

I see that you use the word "Backup" in your path, is that what you want to do? Maybe I'm missing something but I think you need to give more details of what you want to do, otherwise, we can't really help.
 
Last edited:

Ninetailedfox

Member
Downloaded
77.7 GB
Uploaded
296.2 GB
Ratio
3.81
Seedbonus
5,557
Upload Count
0 (0)
Member for 8 years
Technically speaking, you dont need mkdir with xcopy. Xcopy will prompt to create the folder if it's missing or use /i to avoid prompt.

@Ninetailedfox
Not sure what you want to achieve by using Mklink. That is a one-time command, used to create a link or a redirect if you like, between two locations (folders in your case), and even tho you can use it in a batch script, there isn't much sense in doing so. The destination folder must exist prior to creating a link, and the data should already be on the destination folder.
The reason MkLink exists is in case you have software that can only work on a specific disk, to be able to make it work on any other disk.

I see that you use the word "Backup" in your path, is that what you want to do? Maybe I'm missing something but I think you need to give more details of what you want to do, otherwise, we can't really help.
yes thank you.. I want to make symbolic link within C:\Users\%USERNAME%\AppData\Roaming\ that redirect to D:\Backup. because I have program that only works the backup in "C:\Users\%USERNAME%\AppData\Roaming" i just want to help my friend that doesn't know how to backup and that's why i want to make batch script for my compiled program. sorry for my english.

you need mkdir, not mklink
@echo on
mkdir "D:\Backup\folder I want to backup"
xcopy "C:\Users\%USERNAME%\AppData\Roaming\*.*" "D:\Backup\folder I want to backup" /y /e /s /d
exit
mklink is what I want coz I have program that only works the backup in specific location, that's why I want to redirect it to the backup drive. I need symbolic link not the mkdir
 

Cyler

šŸ¤“ Super Admin
āš”OS Master
Downloaded
510.5 GB
Uploaded
24.8 TB
Ratio
49.66
Seedbonus
27,960
Upload Count
1 (1)
Member for 7 years
Mklink is the command you want then but not in a Batch file. Mklink is permanent or at least till you format the disks or remove the folder, so you only need to issue it once. One thing that is not clear is do you want to link a directory or a file? The switch -d you posted is to link a single file (which is why it didn't work probably) but your path shows a directory (roaming) with subfolders for a LOT of programs and if you move them all you may cause issues on other programs. Make sure you set the working path of the program you want ONLY.

WARNING:
Your biggest problem will probably be that because you want to move the roaming folder, windows might not let you since its a protected folder which means you need to do it in safe mode (command prompt with Safe mode), or in case that safe mode won't work, you need to boot with a windows PE like Hiren, move the files and issue the mklink from there and then boot back with normal windows. I never tried to link a system folder so I can't know what the outcome will be. My advice is against this if you don't know very well what you are doing and how to fix it if things go south.



I will use the folders you used but adjust to the folder you really need. This is how it works.
  1. Make sure the folder exists in the destination disk.
  2. Backup (make a zip) of the content of C:\Users\%USERNAME%\AppData\Roaming\ just in case
  3. Move the content of C:\Users\%USERNAME%\AppData\Roaming to the destination folder D:\Backup and erase roaming
  4. Open an administrator command prompt and type mklink /j "C:\Users\%USERNAME%\AppData\Roaming" "D:\Backup"
After that, whenever you or a program want to read/write/erase something from the roaming folder, it will actually happen in the D:\Backup.

Some extra info:
The link will always be there even after restarts etc. The only way to remove it is to use the rmdir and remove the roaming folder (!!) and recreate it and move back all the files from D:\backup.
Make sure that D: (if it's a separate disk) will always be there. Never remove it or change the drive letter etc.
It's always best to test a bit so make a fake folder with some random files and test mklink to see how it works.

Again: Be 110% sure of what you are doing or you might mess up the system.
 
Last edited:

Ninetailedfox

Member
Downloaded
77.7 GB
Uploaded
296.2 GB
Ratio
3.81
Seedbonus
5,557
Upload Count
0 (0)
Member for 8 years
thank you! this is already solved, I've found somewhere else to make a batch script. ;)
 

Skip1

āœ… Verified Member
Member
Downloaded
117.3 GB
Uploaded
3.4 TB
Ratio
29.72
Seedbonus
61,192
Upload Count
26 (23)
Member for 7 years
Thanks all for your input ( @Cyler ), as OP stated problem has been solved.
Thread locked tagged completed.
 
Status
Not open for further replies.
Top