Re: How to copy(not redirect) IE fav to network drive




"Håvard via WinServerKB.com" <u9071@uwe> wrote in message
news:60080cd1046c5@xxxxxx
I am using this cmd file to copy to the network drive:

@echo off
cd /d c:\
cd %userprofile%
xcopy favoritter /h /s /y h:\favoritter
exit

I thought that this script should cover my problem, but I get a syntax
error
(in cmd) when I run it

cd /d h:\
copy h:\favoritter /h /s /y %userprofile%\Favoritter
exit

Any clues?

--
Message posted via http://www.winserverkb.com

There are a few problems with your batch file:
- The line "cd /d h:\" is superfluous. Delete it!
- The copy command does not have a /s switch
and it will not copy subdirectories. Use xcopy.exe
instead.
- "%UserProfile%" has embedded spaces. You must
therefore enclose it with double quotes (which you
should do for all file & folder names in order to make
your batch files more robust.
- You should add a backslash to the target directory,
to ensure that xcopy will create it in case it does not
exist.
- You may want to add the /d switch so that old files
do not get copied each time.

Try this:

@echo off
xcopy h:\favoritter /h /s /y /d "%userprofile%\Favoritter\"


.



Relevant Pages

  • Re: Bash script Slack >> Deb-Etch
    ... echo>> ~/.signature ... -wF chokes cut, and the switch isn't ... Somehow in the script ...
    (comp.os.linux.misc)
  • Re: Bash script Slack >> Deb-Etch
    ... echo>> ~/.signature ... and cut is counting each one as a delimiter. ... -wF chokes cut, and the switch isn't ...
    (comp.os.linux.misc)
  • Re: Batch File to manipulate path and file name
    ... This batch file should get you started. ... #echo Full name=%* ... How do I get from Input File Name to Output File Name Desired? ... a program called switch. ...
    (microsoft.public.windowsxp.general)
  • Re: Batch file
    ... You can use the "exit" command in a batch file if you ... @echo off ...
    (microsoft.public.win2000.general)
  • Re: logging batch files
    ... @ECHO ON ... exit /b 0 ... COMMAND 1 ... > batch file to the end while it processes? ...
    (microsoft.public.win2000.cmdprompt.admin)