From: Pegasus [MVP] on 17 Jun 2010 15:57 Type these commands at the command Prompt: SET Log_Path="C:\Scripts" SET Log_FName=log.txt echo options=/R:0 /W:0 /LOG+:%Log_Path%+%log_fname% Does this answer your question? Note also that "C:\Scripts" does not need any surrounding double quotes. Their existence won't cause a problem but it is not "nice" to have double quotes in the middle of a fully qualified file name. "JohnB" <jbrigan(a)yahoo.com> wrote in message news:uRcOqTlDLHA.2052(a)TK2MSFTNGP06.phx.gbl... >> you can find the log file in the System32 folder. > You're exacty right, that's where it was. > > I'd like to add this line: > SET Log_Path="C:\Scripts" > > And then modify the "set options" line. > > How would that work, like this: > > SET options=/R:0 /W:0 /LOG+:%Log_Path%+%log_fname% /NFL /NDL > or this: > SET options=/R:0 /W:0 /LOG+:%Log_Path%, %log_fname% /NFL /NDL > or this: > SET options=/R:0 /W:0 /LOG+:%Log_Path% %log_fname% /NFL /NDL > > With the separator being a plus sign, comma or space? > > > "Pegasus [MVP]" <news(a)microsoft.com> wrote in message > news:uCTkKokDLHA.4256(a)TK2MSFTNGP06.phx.gbl... >>I modified your last line to >> >> echo ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% >> %exclude_dirs% %exclude_files% >> >> then ran the batch file and examined its output. It works perfectly well >> in every regard but since you did not specify a drive or folder for your >> log file it ended up who knows where but certainly not where you expected >> it. In batch files it is compulsory to fully qualify all file names. >> Chances are you can find the log file in the System32 folder. >> >> "JohnB" <jbrigan(a)yahoo.com> wrote in message >> news:eaJMF1jDLHA.3776(a)TK2MSFTNGP04.phx.gbl... >>> This is the entire script: >>> >>> --------------------------- >>> @Echo off >>> REM Backup user files to external drive >>> REM. >>> REM. >>> SET prefix=robocopy_backup >>> SET source_dir="E:\users" >>> SET dest_dir="H:\BD_Users_Backup" >>> REM. >>> REM. >>> REM Set the log file name based on the current date. This >>> REM will record the results from the robocopy command. >>> REM The typical format for the date command is: >>> REM Mon 11/09/2000 >>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >>> SET what_to_copy=/COPY:DAT /MIR >>> REM Exclude some files and directories that include transient data >>> REM that doesn't need to be copied. >>> SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" >>> "Cookies" "iPod Photo Cache" "MachineKeys" >>> SET exclude_files=/XF *.bak *.tmp index.dat usrclass.dat* ntuser.dat* >>> *.lock *.swp >>> SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL >>> ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% %exclude_dirs% >>> %exclude_files% >>> >>> :END >>> --------------------------- >>> >>> But what is odd is, it creates the log file when run manually. It does >>> not when run from scheduler. This is on Sever 2008 standard. >>> >>> >>> >>> >>> >>> "Pegasus [MVP]" <news(a)microsoft.com> wrote in message >>> news:uvn2gwjDLHA.1888(a)TK2MSFTNGP05.phx.gbl... >>>> >>>> >>>> "JohnB" <jbrigan(a)yahoo.com> wrote in message >>>> news:OV814khDLHA.5436(a)TK2MSFTNGP04.phx.gbl... >>>>> I've always used xcopy in the past, but recently decided I need to >>>>> become familiar with RoboCopy. I found a sample batch file to back up >>>>> folder(s) to an external drive. Modified it a little. And it does >>>>> just what I need. When run manually it creates a log file with this >>>>> command: >>>>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >>>>> >>>>> But I'm running it from Task Scheduler. It ran fine last night, the >>>>> first time it was run. Everything backed up. But, no log file was >>>>> created. >>>>> How could running it from the scheduler affect that? >>>> >>>> Can't tell without knowing the value of %prefix%. Anyway, you can >>>> easily find out yourself by logging what's going on, e.g. like so: >>>> @echo off >>>> echo %date% %time% >>>> log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log>>c:\problem.txt >>>> >>>> It would also help if you posted your whole robocopy command line. >>> >>> > >
From: JohnB on 17 Jun 2010 16:42 >>Does this answer your question? Yes indeedy. Didn't think of the echo command. Thanks. "Pegasus [MVP]" <news(a)microsoft.com> wrote in message news:%23BuVTdlDLHA.4400(a)TK2MSFTNGP05.phx.gbl... > Type these commands at the command Prompt: > SET Log_Path="C:\Scripts" > SET Log_FName=log.txt > echo options=/R:0 /W:0 /LOG+:%Log_Path%+%log_fname% > > Does this answer your question? Note also that "C:\Scripts" does not need > any surrounding double quotes. Their existence won't cause a problem but > it is not "nice" to have double quotes in the middle of a fully qualified > file name. > > "JohnB" <jbrigan(a)yahoo.com> wrote in message > news:uRcOqTlDLHA.2052(a)TK2MSFTNGP06.phx.gbl... >>> you can find the log file in the System32 folder. >> You're exacty right, that's where it was. >> >> I'd like to add this line: >> SET Log_Path="C:\Scripts" >> >> And then modify the "set options" line. >> >> How would that work, like this: >> >> SET options=/R:0 /W:0 /LOG+:%Log_Path%+%log_fname% /NFL /NDL >> or this: >> SET options=/R:0 /W:0 /LOG+:%Log_Path%, %log_fname% /NFL /NDL >> or this: >> SET options=/R:0 /W:0 /LOG+:%Log_Path% %log_fname% /NFL /NDL >> >> With the separator being a plus sign, comma or space? >> >> >> "Pegasus [MVP]" <news(a)microsoft.com> wrote in message >> news:uCTkKokDLHA.4256(a)TK2MSFTNGP06.phx.gbl... >>>I modified your last line to >>> >>> echo ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% >>> %exclude_dirs% %exclude_files% >>> >>> then ran the batch file and examined its output. It works perfectly well >>> in every regard but since you did not specify a drive or folder for your >>> log file it ended up who knows where but certainly not where you >>> expected it. In batch files it is compulsory to fully qualify all file >>> names. Chances are you can find the log file in the System32 folder. >>> >>> "JohnB" <jbrigan(a)yahoo.com> wrote in message >>> news:eaJMF1jDLHA.3776(a)TK2MSFTNGP04.phx.gbl... >>>> This is the entire script: >>>> >>>> --------------------------- >>>> @Echo off >>>> REM Backup user files to external drive >>>> REM. >>>> REM. >>>> SET prefix=robocopy_backup >>>> SET source_dir="E:\users" >>>> SET dest_dir="H:\BD_Users_Backup" >>>> REM. >>>> REM. >>>> REM Set the log file name based on the current date. This >>>> REM will record the results from the robocopy command. >>>> REM The typical format for the date command is: >>>> REM Mon 11/09/2000 >>>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >>>> SET what_to_copy=/COPY:DAT /MIR >>>> REM Exclude some files and directories that include transient data >>>> REM that doesn't need to be copied. >>>> SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" >>>> "Cookies" "iPod Photo Cache" "MachineKeys" >>>> SET exclude_files=/XF *.bak *.tmp index.dat usrclass.dat* ntuser.dat* >>>> *.lock *.swp >>>> SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL >>>> ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% >>>> %exclude_dirs% %exclude_files% >>>> >>>> :END >>>> --------------------------- >>>> >>>> But what is odd is, it creates the log file when run manually. It does >>>> not when run from scheduler. This is on Sever 2008 standard. >>>> >>>> >>>> >>>> >>>> >>>> "Pegasus [MVP]" <news(a)microsoft.com> wrote in message >>>> news:uvn2gwjDLHA.1888(a)TK2MSFTNGP05.phx.gbl... >>>>> >>>>> >>>>> "JohnB" <jbrigan(a)yahoo.com> wrote in message >>>>> news:OV814khDLHA.5436(a)TK2MSFTNGP04.phx.gbl... >>>>>> I've always used xcopy in the past, but recently decided I need to >>>>>> become familiar with RoboCopy. I found a sample batch file to back >>>>>> up folder(s) to an external drive. Modified it a little. And it >>>>>> does just what I need. When run manually it creates a log file with >>>>>> this command: >>>>>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >>>>>> >>>>>> But I'm running it from Task Scheduler. It ran fine last night, the >>>>>> first time it was run. Everything backed up. But, no log file was >>>>>> created. >>>>>> How could running it from the scheduler affect that? >>>>> >>>>> Can't tell without knowing the value of %prefix%. Anyway, you can >>>>> easily find out yourself by logging what's going on, e.g. like so: >>>>> @echo off >>>>> echo %date% %time% >>>>> log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log>>c:\problem.txt >>>>> >>>>> It would also help if you posted your whole robocopy command line. >>>> >>>> >> >>
From: JohnB on 21 Jun 2010 08:53 Turns out it needs to be this: options=/R:0 /W:0 /LOG+:%Log_Path%%log_fname% No plus sign, and no space between the path and filename variables. The plus sign would give a filename with a plus sign in it. "Pegasus [MVP]" <news(a)microsoft.com> wrote in message news:%23BuVTdlDLHA.4400(a)TK2MSFTNGP05.phx.gbl... > Type these commands at the command Prompt: > SET Log_Path="C:\Scripts" > SET Log_FName=log.txt > echo options=/R:0 /W:0 /LOG+:%Log_Path%+%log_fname% > > Does this answer your question? Note also that "C:\Scripts" does not need > any surrounding double quotes. Their existence won't cause a problem but > it is not "nice" to have double quotes in the middle of a fully qualified > file name. > > "JohnB" <jbrigan(a)yahoo.com> wrote in message > news:uRcOqTlDLHA.2052(a)TK2MSFTNGP06.phx.gbl... >>> you can find the log file in the System32 folder. >> You're exacty right, that's where it was. >> >> I'd like to add this line: >> SET Log_Path="C:\Scripts" >> >> And then modify the "set options" line. >> >> How would that work, like this: >> >> SET options=/R:0 /W:0 /LOG+:%Log_Path%+%log_fname% /NFL /NDL >> or this: >> SET options=/R:0 /W:0 /LOG+:%Log_Path%, %log_fname% /NFL /NDL >> or this: >> SET options=/R:0 /W:0 /LOG+:%Log_Path% %log_fname% /NFL /NDL >> >> With the separator being a plus sign, comma or space? >> >> >> "Pegasus [MVP]" <news(a)microsoft.com> wrote in message >> news:uCTkKokDLHA.4256(a)TK2MSFTNGP06.phx.gbl... >>>I modified your last line to >>> >>> echo ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% >>> %exclude_dirs% %exclude_files% >>> >>> then ran the batch file and examined its output. It works perfectly well >>> in every regard but since you did not specify a drive or folder for your >>> log file it ended up who knows where but certainly not where you >>> expected it. In batch files it is compulsory to fully qualify all file >>> names. Chances are you can find the log file in the System32 folder. >>> >>> "JohnB" <jbrigan(a)yahoo.com> wrote in message >>> news:eaJMF1jDLHA.3776(a)TK2MSFTNGP04.phx.gbl... >>>> This is the entire script: >>>> >>>> --------------------------- >>>> @Echo off >>>> REM Backup user files to external drive >>>> REM. >>>> REM. >>>> SET prefix=robocopy_backup >>>> SET source_dir="E:\users" >>>> SET dest_dir="H:\BD_Users_Backup" >>>> REM. >>>> REM. >>>> REM Set the log file name based on the current date. This >>>> REM will record the results from the robocopy command. >>>> REM The typical format for the date command is: >>>> REM Mon 11/09/2000 >>>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >>>> SET what_to_copy=/COPY:DAT /MIR >>>> REM Exclude some files and directories that include transient data >>>> REM that doesn't need to be copied. >>>> SET exclude_dirs=/XD "Temporary Internet Files" "Cache" "Recent" >>>> "Cookies" "iPod Photo Cache" "MachineKeys" >>>> SET exclude_files=/XF *.bak *.tmp index.dat usrclass.dat* ntuser.dat* >>>> *.lock *.swp >>>> SET options=/R:0 /W:0 /LOG+:%log_fname% /NFL /NDL >>>> ROBOCOPY %source_dir% %dest_dir% %what_to_copy% %options% >>>> %exclude_dirs% %exclude_files% >>>> >>>> :END >>>> --------------------------- >>>> >>>> But what is odd is, it creates the log file when run manually. It does >>>> not when run from scheduler. This is on Sever 2008 standard. >>>> >>>> >>>> >>>> >>>> >>>> "Pegasus [MVP]" <news(a)microsoft.com> wrote in message >>>> news:uvn2gwjDLHA.1888(a)TK2MSFTNGP05.phx.gbl... >>>>> >>>>> >>>>> "JohnB" <jbrigan(a)yahoo.com> wrote in message >>>>> news:OV814khDLHA.5436(a)TK2MSFTNGP04.phx.gbl... >>>>>> I've always used xcopy in the past, but recently decided I need to >>>>>> become familiar with RoboCopy. I found a sample batch file to back >>>>>> up folder(s) to an external drive. Modified it a little. And it >>>>>> does just what I need. When run manually it creates a log file with >>>>>> this command: >>>>>> SET log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log >>>>>> >>>>>> But I'm running it from Task Scheduler. It ran fine last night, the >>>>>> first time it was run. Everything backed up. But, no log file was >>>>>> created. >>>>>> How could running it from the scheduler affect that? >>>>> >>>>> Can't tell without knowing the value of %prefix%. Anyway, you can >>>>> easily find out yourself by logging what's going on, e.g. like so: >>>>> @echo off >>>>> echo %date% %time% >>>>> log_fname=%prefix%%date:~-4,4%%date:~-10,2%%date:~-7,2%.log>>c:\problem.txt >>>>> >>>>> It would also help if you posted your whole robocopy command line. >>>> >>>> >> >>
From: Pegasus [MVP] on 21 Jun 2010 10:48 "JohnB" <jbrigan(a)yahoo.com> wrote in message news:#am29CUELHA.4504(a)TK2MSFTNGP02.phx.gbl... > Turns out it needs to be this: > options=/R:0 /W:0 /LOG+:%Log_Path%%log_fname% > > No plus sign, and no space between the path and filename variables. The > plus sign would give a filename with a plus sign in it. Exactly!
First
|
Prev
|
Pages: 1 2 Prev: HMS Host activation on w2k3 R2 Next: Error while backup System State via Windows Server Backup |