Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Basic_Programming
- Posts: 1
- Joined: 05 Jul 2012 02:55
#1
Post
by Basic_Programming » 05 Jul 2012 03:03
Hi Guys
I am doing a batch file to copy a PDF from the C:\ Drive - the D:\users desktop folder. i have used the xcopy command to do this and also the %HOMEPATH% command aswell so it goes to the users desktop folder to then display it on the desktop, but this isnt working any help.
sorry for not much detail as i dont do alot of DOS

-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#2
Post
by foxidrive » 05 Jul 2012 04:00
Is this a class assignment?

what have you got so far?
-
e4nd
- Posts: 12
- Joined: 17 Mar 2012 02:28
#3
Post
by e4nd » 05 Jul 2012 10:03
User_List.txt - %ComputerName% users or IP addresses
set drive=d - target disk
Code: Select all
@echo off
set drive=d
for /f "delims=" %%! in (User_List.txt) do (
copy "c:\Drive\*.pdf" "\\%%!\%drive%$\%HOMEPATH%\desktop\*.pdf"
)
pause>nul
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#4
Post
by Dos_Probie » 06 Jul 2012 19:10
I am doing a batch file to copy a PDF from the C:\ Drive - the D:\users desktop folder
You could use the For command to copy a user list from a text file
or you could just keep it simple and use a user variable for different default users.<see code below>
Code: Select all
@echo off
::use wildcard to copy over all .pdf file/s from C <source> to the system or d drive <destination>::
xcopy c:\*.pdf %userprofile%\desktop\Pdf\ /s/e/h/f/c/q/i