Here is something even more optimized (this is of course if the file names
are like you displayed!):

    Dim bFound, i
    bFound = False

    For i = 1 To 3
        If Len(Dir("c:\dir\file." & i)) = 0 Then
            bFound = True

            If MsgBox("Prompt", vbYesNo, "title") = vbYes Then
                FileCopy "Source", "Destination"
            Else
                FileCopy "c:\dir\file." & i, "c:\dir\file." & i + 1
                Kill "c:\dir\file." & i
            End If

                Exit For
        End If
    Next

    If Not bFound Then MsgBox "message to user that they must request the
file.", vbInformation, "title"


-----Original Message-----
From: Gavin Landon [mailto:[EMAIL PROTECTED]]On Behalf Of
[EMAIL PROTECTED]
Sent: Friday, August 31, 2001 2:09 PM
To: NT System Admin Issues
Subject: RE: NT 4.0 Scripting dilemma


Is this VBScript or what?

I would do this, because it's easy to get confused with nested IF
statements.

    Select Case False
    Case Len(Dir("c:\dir\file.1")) = 0
        If MsgBox("Prompt", vbYesNo, "title") = vbYes Then
            FileCopy "Source", "Destination"
        Else
            FileCopy "c:\dir\file.1", "c:\dir\file.2"
            Kill "c:\dir\file.1"
        End If
    Case Len(Dir("c:\dir\file.2")) = 0
        If MsgBox("Prompt", vbYesNo, "title") = vbYes Then
            FileCopy "Source", "Destination"
        Else
            FileCopy "c:\dir\file.2", "c:\dir\file.3"
            Kill "c:\dir\file.2"
        End If
    Case Len(Dir("c:\dir\file.3")) = 0
        If MsgBox("Prompt", vbYesNo, "title") = vbYes Then
            FileCopy "Source", "Destination"
        Else
            FileCopy "c:\dir\file.3", "c:\dir\file.4"
            Kill "c:\dir\file.3"
        End If
    Case Else
        MsgBox "message to user that they must request the file.",
vbInformation, "title"
    End Select


-----Original Message-----
From: William Rogge [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 12:06 PM
To: NT System Admin Issues
Subject: NT 4.0 Scripting dilemma


I have coded '0' login scripts, but now must create one per my boss.

Simply stated, we have a file that we want to push down to each client.  We
also want to allow the client 3 attempts at getting the file.  Reason being
that a lot of them are over dial-up connections and the file is quite
large.

My impression is something like this:

if file.1 exists then
   prompt user if they want it.
   if yes then
      copy file to client
   else
      rename file.1 to file.2
   end if
else
   if file.2 exists then
      prompt user if they want it.
      if yes then
         copy file to client
      else
         rename file.1 to file.2
      end if
   else
      if file.3 exists  then
         prompt user if they want it.
         if yes then
            copy file to client
         else
            rename file.1 to file.2
         end if
      else
         message to user that they must request the file.
      end if
   end if
end if


To me this makes sense, but how does one do this in a login-on script?
 What script commands can be used to accomplish this?

http://www.sunbelt-software.com/ntsysadmin_list_charter.htm






http://www.sunbelt-software.com/ntsysadmin_list_charter.htm






http://www.sunbelt-software.com/ntsysadmin_list_charter.htm

Reply via email to