Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have been having 0 files copied message when attempting to Xcopy files.
Note that I managed to do it successfully by specifying an exact source path as shown below:
xcopy /y %USERPROFILE%\Desktop\WinXTweak\program1.exe %WINDIR%\
xcopy /y %USERPROFILE%\Desktop\WinXTweak\program2.exe %WINDIR%\
xcopy /y %USERPROFILE%\Desktop\WinXTweak\program3.exe %WINDIR%\
Of course, this would only work if the WinXTweak folder is on the desktop. I would like to be able to copy it into a USB drive for instance or any location in my PC and run it. The location of the batch file is inside the WinXTweak folder too. I could not figure out what to do. I tried the ones below but it did fail.
xcopy /y program1.exe %WINDIR%\
xcopy /y program2.exe %WINDIR%\
xcopy /y program3.exe %WINDIR%\
Thanks all in advance,
Thanks all for your reply. After reading more stuff online, I was able to resolve the issue by using the following code. I am a newbie at this, and there might be a much simpler way this is what I used.
#echo off
set source=%~dp0*.exe
set target="%WINDIR%"
xcopy /y "%source%" "%target%"
The suggested answers I will take note and learn so I can use it in the future.
Thank you for helping and best regards,
Related
I have tried to copy the file the file structure from an old disc to a new one without copying the files. I have used the command xcopy E:\Richard\Documents C:\Users\Documents /T /E /Q and got the question whether C:\Users\Documents is a file or a directory, answered "directory" and got the answer Access denied. Why? Is it something with the attributes of C?
Can I improve the command in some way?
Something outsida the command that I should do?
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I think this should be rather simple but I want to delete all the files that are stated in for example: C:\TEST but I want to leave the files that are located in subdirectories of this folder. For example files in the folder: C:\TEST\Backup should not be deleted.
When using the following batch command all the files get deleted including those located in sub directories but it leaves the folder:
DEL /S C:\TEST\ /q
Does anyone know the command that I need?
It is as simple as this:
from cmdline:
for %a IN (C:\TEST\*.*) do echo "%a"
OR In a batch script, just add an additional %
for %%a IN (C:\TEST\*.*) do echo "%%a"
Just replace echo with del once you are confident with your final script.
OR simply doing:
del C:\TEST /q
All these things can be found by simply opening cmd.exe and running ANY of the commands with the /? switch. For instance.
for /?
del /?
etc.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am tasked with a batch sorting script. And i don't know how to start.
I have thousand of PDF files and they are generated with a number, some are generated with a letter either O or P, they need to be sorted into a separate folder.
For now all i got is:
xcopy "c:\Test 1" "c:\Test 1\sorted" /y
pause
But have no idea how to proceed.
//Merry Christmas
Give this a try.
#echo off
PUSHD "c:\Test 1"
MD SORTED 2>nul
FOR %%G IN (*O.pdf *P.PDF) DO MOVE "%%G" SORTED
POPD
#ECHO OFF
set pathtoFolder="C:Test 1"
set destination="C:\Test 1\Sorted"
FOR /R %pathtoFolder% %%G IN (*O.txt *P.txt) DO (
echo %%G
xcopy %%G %destination%
)
Based upon the comments, I'm assuming that the O and P are at the end of the file. Leave a comment if there are any errors, and I shall correct.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In the end, I want to copy the last modified folder in a directory. In order to do this, I need to pass in the name of the last modified folder to xcopy.
How do you find the last modified folder, not file, in a directory with command prompt? I have found many scripts that will find the last modified file, but I cannot seem to find a command that will find the last modified folder.
Any help would be appreciated.
#echo off
for /f "delims=" %%a in (' dir /ad /od /b ') do set "folder=%%a"
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 13 years ago.
Improve this question
In windowsxp, I use "del /s /q myfolder" to delete a big folder. It will list all files and folders being deleted. is there a way to avoid that long display list?
thanks,
rmdir /s /q myfolder
or rmdir del /s /q myfolder > nul
Which is the equivalent of the Unix/Linux's /dev/null which throws away any outputs as they are redirected to a black hole of a bit bucket...
Edit: Thanks Heinzi for my stoopid error....I have struck out the rmdir and replaced it with del :)
Hope this helps,
Best regards,
Tom.