Jump to content
Sign in to follow this  
owensct

EunWait to execute Robocopy problem

Recommended Posts

Hi All,

I have this RunWait command in a script I am writing. I don't get any errors, it just doesn't run. I've stared at it until my eyes are crossed :) . Can anybody see what I'm missing as I can't seem to figure out where I have it incorrectly written. ;)

Any help would be appreciated.

RunWait('robocopy196 \\rhp-vms-001\ANSOSONESTAFF\data\ \\rhp-vms-001\Staff_backups\Daily_%date:~4,2%%date:~7,2%%date:~12,2%_%time:~0,2%%time:~3,2%%time:~6,2% *.* /s /e /log:\\rhp-vms-001\Staff_backups\Dailylog_%date:~4,2%%date:~7,2%%date:~12,2%_%time:~0,2%%time:~3,2%%time:~6,2%.log')

The command works fine from a command line, but when I try to set it up to execute via RunWait, the script acts like its doing what it's supposed to but it never completes the copy operation.

Sorry if this is a dumb question, I'm new to AutoIt. ;)

Share this post


Link to post
Share on other sites

Hi All,

I have this RunWait command in a script I am writing. I don't get any errors, it just doesn't run. I've stared at it until my eyes are crossed :) . Can anybody see what I'm missing as I can't seem to figure out where I have it incorrectly written. ;)

Any help would be appreciated.

RunWait('robocopy196 \\rhp-vms-001\ANSOSONESTAFF\data\ \\rhp-vms-001\Staff_backups\Daily_%date:~4,2%%date:~7,2%%date:~12,2%_%time:~0,2%%time:~3,2%%time:~6,2% *.* /s /e /log:\\rhp-vms-001\Staff_backups\Dailylog_%date:~4,2%%date:~7,2%%date:~12,2%_%time:~0,2%%time:~3,2%%time:~6,2%.log')

The command works fine from a command line, but when I try to set it up to execute via RunWait, the script acts like its doing what it's supposed to but it never completes the copy operation.

Sorry if this is a dumb question, I'm new to AutoIt. ;)

All,

Well I have this sort of figured out, the only issue I have now is in trying to append the date and time to the name of the folder that teh job creates:

This works in AutoIt

RunWait('robocopy "\\rhp-vms-001\backuptest" "\\rhp-vms-001\Staff_backups\Daily_"/COPYALL /S /E /V /LOG+:"\\rhp-vms-001\staff_backups\ROBOCOPY_LOG.txt"')

This works on the command line

robocopy \\rhp-vms-001\backuptest \\rhp-vms-001\Staff_backups\Daily_%date:~4% /COPYALL /S /E /V /LOG:\\rhp-vms-001\staff_backups\ROBOCOPY_LOG.txt

This yeilds a folder in the Staff_backup folder called Daily_09

I have tried various means of accomplishing the same thing in AutoIt and so far no success:

None of these work

RunWait('robocopy "\\rhp-vms-001\backuptest" "\\rhp-vms-001\Staff_backups\Daily_%date:~4%" /COPYALL /S /E /V /LOG+:"\\rhp-vms-001\staff_backups\ROBOCOPY_LOG.txt"')

or

RunWait('robocopy "\\rhp-vms-001\backuptest" "\\rhp-vms-001\Staff_backups\Daily_" '%date:~4%' /COPYALL /S /E /V /LOG+:"\\rhp-vms-001\staff_backups\ROBOCOPY_LOG.txt"')

or

RunWait('robocopy "\\rhp-vms-001\backuptest" "\\rhp-vms-001\Staff_backups\Daily_" %date:~4% /COPYALL /S /E /V /LOG+:"\\rhp-vms-001\staff_backups\ROBOCOPY_LOG.txt"')

or

RunWait('robocopy "\\rhp-vms-001\backuptest" "\\rhp-vms-001\Staff_backups\Daily_" &%date:~4%& /COPYALL /S /E /V /LOG+:"\\rhp-vms-001\staff_backups\ROBOCOPY_LOG.txt"')

or

$line = '%date:~4% '

RunWait('robocopy "\\rhp-vms-001\backuptest" "\\rhp-vms-001\Staff_backups\Daily_" '& $line &' /COPYALL /S /E /V /LOG+:"\\rhp-vms-001\staff_backups\ROBOCOPY_LOG.txt"')

Can somebody clue me into what is wrong with my syntax? This is driving me crazy and I'm trying to meet a deadline to get this tested and in production.

:shocked:

Thanks

Gordon

Share this post


Link to post
Share on other sites

Just from the basis of looking at it, and bearing in mind im a noob with Autoit...

The obvious factor between the ones that work in Autoit and the ones that don't is the %date:~4%

The one that works in cmd is prob cos the %date% parameter is native

Can you not set the date but add it after the robocopy in the log maybe so it dosen't conflict?

Please bear in mind i definatly dont know about Autoit ;o)

In cmd i do this

set t=2&if "%date%z" LSS "A" set t=1

for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo.^|date') do (

for /f "tokens=%t%-4 delims=.-/ " %%d in ('date/t') do (

set %%a=%%d&set %%b=%%e&set %%c=%%f))

which gives me

%dd%.%mm%.%yy%

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...