I tried robocopy to test copy a single file from a folder to the desktop, and then many files from the desktop disappeared (not hidden).
Now I am desperate to retrieve those files.
I used the script
ROBOCOPY "C:\Users\frank\Desktop\New" "C:\Users\frank\Desktop" /mir
in a txt file and renamed it to .bat.
Then i ran it as admin.
A prompt then opened with many file names rushing past until i closed it.
Now many files are missing from the desktop.
I have tried to research what happened and only came up with cases where robocopy set the copied files to "hidden". But i have set the desktop folder attributes to "show" (it was set to hidden) and they are still missing.
The single file in the "new" folder i was trying to copy over, did not move.
Related
I want to create a .bat file with a command line inside that deletes all content of the C:\Users\Documents folder. I only want to delete the entire content of the folder, not the folder itself.
Why do I need this? Our company helps unemployed people find jobs and they use our laptops to create CVs and application lettres. They forget to delete their data (most of them don't really know how to use a computer) so I am trying to automate this process with a .bat file and a scheduled task (run script when user logs in).
If the laptops were WIN10 Pro, I would have used group policies in AD, but these computers are WIN10 home.
Any Ideas? Thank you for your help.
One other way to do it is to copy an empty directory using robocopy to the documents folder. So as an example, Create a directory called none.
In this example, I created the empty directory as D:\none
robocopy "D:\none" "%userprofile%\Documents" /MIR
This will work from cmd and in a batch-file.
I'm working with an application that was poorly designed. When installed, it creates a .INI file (remember those?) in the C:\Windows folder. In order to get things working correctly in our environment, I don't use that .INI file. Instead, I have separate .INI files in a different location where I can properly management them within the framework of the application. The problem I'm running in to is users not running the application correctly so it picks up this default .INI file that doesn't work in our environment (remember I said the application is poorly designed).
To make sure that my users are running the correct configuration, I need to delete this pesky .INI from the C:\Windows folder. I have .BAT files that manage application launch and updates so I tried to just issue a delete in the .BAT file but it isn't working. When I try to run just the delete command in a command window, I get "Access Denied". I can't rename it or move it either. I would just go touch each computer but don't have the time to get to them all.
I have just spent the last two hours googling to find a solution and the only solutions are to use Windows Explorer which isn't an option. I know it has to be something simple that I haven't been able to find. Ideas?
for /f "usebackq delims=" %A in ("%userprofile%\Desktop\ComputerName.txt") do echo Del \\%A\C$\Windows\file.ini
Computername.txt is one computer per line, names or addresses.
127.0.0.1
I tried to copy a file to System32 with this batch and it said "Access denied":
xcopy "BACKGROUNDDEFAUL.jpg" "C:\Windows\System32\oobe\info\backgrounds\"
pause
Is there a way to do it? If not, why?
C:\Windows\ contains the operating system. You can't directly modify the files in it and its subfolders (such as System32) because an improper modification can break your computer.
To set a picture as background, right-click it and click "Set as desktop background".
I have a batch file, and i need to move a folder from one directory to another.
I can do that no problem. But, im hitting a problem after that.
The folder i just moved is created at run time, then moved to the final destination folder where it needs to remain, unless the user decides to delete it.
So, if the user runs the batch file a second time, when it tries to move the run time folder, there is already the old version of the folder at the destination and it gives a "permission denied" error.
So my question is, what is the best way to overwrite the contents of a folder from a batch file?
Right now i am just using the move command. Which works fine for overwriting regular files, but it cannot overwrite folders apparently.
Thanks.
Would suggest to use either xcopy or robocopy for Overwriting folders
Xcopy /E /Y would Overwrite folder ,
please find More options Xcopy /?
Please note that i have mentioned this options only to overwrite and not to move folder.
am a newbie to the batch script, i have many folders called LIB in my drive
say it can be as LIB_data,lib,lib_ac anything that starts with lib or LIB... i want to list all these directories and sort them in which they have created in the pc and copy the latest directory contents to BATCH_LATEST_LIB_FILES folder,that will be a new folder created by this batch file.i want this new folder to be created in the path where this batch file is present. please help me with a batch script.
You might look at FOR, DATE, TIME, SORT, IF, GOTO and XCOPY.
This site is a great resource for batch files.