Sign in to follow this  
Followers 0
tegelaar

Help With A Loop

2 posts in this topic

I am trying to copy a file to the local machine via logon script and then execute it.

The script is failing because the file does not always copy over.

Can I make a loop that will check if the file is there, and if it isn't, try to copy it again?

Here is my script so far:

DirCreate("C:\DSClient")

FileCopy('\\nemaster01\netlogon\dsclient\dsclient.exe', "C:\DSClient\", 1)

RunWait('C:\DSClient\DSClient.exe /t:C:\DSClient /c',"", @SW_HIDE)

Run('c:\dsclient\setup.exe /q', "C:\dsclient", @SW_HIDE)

WinActivate ("System Settings Change")

WinWaitActive("System Settings Change")

Send("N")

DirRemove("C:\DSClient", 1)

So after the second line, if c:\dsclient\dsclient.exe doesnt exist, try to copy it again from the share.

Incidentally, the script works fine if double clicked on - seems it only fails when running via logon script.

Thanks for any help

-Jim

Share this post


Link to post
Share on other sites



I am trying to copy a file to the local machine via logon script and then execute it.

The script is failing because the file does not always copy over.

Can I make a loop that will check if the file is there, and if it isn't, try to copy it again?

Here is my script so far:

DirCreate("C:\DSClient")

FileCopy('\\nemaster01\netlogon\dsclient\dsclient.exe', "C:\DSClient\", 1)

RunWait('C:\DSClient\DSClient.exe /t:C:\DSClient /c',"", @SW_HIDE)

Run('c:\dsclient\setup.exe /q', "C:\dsclient", @SW_HIDE)

WinActivate ("System Settings Change")

WinWaitActive("System Settings Change")

Send("N")

DirRemove("C:\DSClient", 1)

So after the second line, if c:\dsclient\dsclient.exe doesnt exist, try to copy it again from the share.

Incidentally, the script works fine if double clicked on - seems it only fails when running via logon script.

Thanks for any help

-Jim

How does this look?

DirCreate("C:\DSClient")

While NOT FileExists("C:\DSClient\DSClient.exe")

FileCopy('\\nemaster01\netlogon\dsclient\dsclient.exe', "C:\DSClient\", 1)

Wend

RunWait('C:\DSClient\DSClient.exe /t:C:\DSClient /c',"", @SW_HIDE)

Run('c:\dsclient\setup.exe /q', "C:\dsclient", @SW_HIDE)

WinActivate ("System Settings Change")

WinWaitActive("System Settings Change")

Send("N")

DirRemove("C:\DSClient", 1)

-Jim

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  
Followers 0