No announcement yet.

Problem with Xcopy in Startup script

  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Xcopy in Startup script

    I am having a problem with Xcopy in a startup BAT script called via a group policy.

    Here's what I'm up to:

    1. I'm using group policy to update Google Desktop in a mixed environment of Win2000 and WinXP PCs. The current version of Google Desktop will not run on a Win2K PC unless the program file directory for the application includes an updated version of gdiplus.dll.
    2. Not being all that knowledgeable about scripts, I decided to modify a pair of scripts bequeathed to me by a far more knowledgeable intern who used to work for me.
    3. The first script is a VBS script that determines the operating system of the PC and then, in effect, says "If your Win2K execute this BAT file. In your WinXP dont bother." In both cases a short text file is left behind to prevent the VBS script from running again unnecessarily.
    4. As far as I can tell the VBS script in AOK.
    5. The problem is with the BAT file, which is as follows:
    xcopy /Y "\\DS2\Network Services\GoogleDesktop\gdiplus\gdiplus.dll" "%ProgramFiles%\google\Google Desktop Search\gdiplus.dll"
    Where \\DS2\Network Services\etc... is a UNC path to the PC where the script and the rest of the google desktop installation files are stored.

    6. When the script runs on a remote PC via GP it hangs the PC. When I run it manually by calling from \\DS2 I get the following:
    CMD.EXE was started with '\\ds2\Network Services\GoogleDesktop\gdiplus' as the current directory path. UNC paths are not supported. Defaulting to Windows directory.

    C:\WINNT>xcopy /Y "\\DS2\Network Services\GoogleDesktop\gdiplus\gdiplus.dll" "C:
    \Program Files\google\Google Desktop Search\gdiplus.dll"
    Does C:\Program Files\google\Google Desktop Search\gdiplus.dll specify a file name
    or directory name on the target (F = file, D = directory)?
    I think the problem has to do with the message "UNC paths are not supported".

    7. I'm not sure what to do next as I have examples of similar scripts called via GP that run just fine. However they are login scripts, not startup scripts.

    Any thoughts or help will be appreciated!!

  • #2
    Re: Problem with Xcopy in Startup script

    One solution you can use is to map the network share as a speciffic drive letter at the beginning of the BAT file and to remove the mapping at the end.
    net use [driveletter] \\servername\share to map and
    net use [driveletter] /delete to delete the map.
    I assume you don't have problems with permissions to the share. If you need more info, use net use /?.
    Of course, you should change the xcopy command accordingly:
    xcopy /Y "[driveletter]\GoogleDesktop\gdiplus\gdiplus.dll" "%ProgramFiles%\google\Google Desktop Search\gdiplus.dll"

    BTW, if you asked yourself why is that, read this article: You have there a workaround too.
    Last edited by sorinso; 6th January 2007, 14:20.

    Sorin Solomon

    In order to succeed, your desire for success should be greater than your fear of failure.


    • #3
      Re: Problem with Xcopy in Startup script

      Do not include the filename in the destinaton-path. And end that path with a \
      That way Windows is not confused any more wether gdiplus.dll is the name of a file or is a foldername.

      See how the destinatin is written in this example;
      @Xcopy.exe /O /D /y "\\DS2\Network Services\GoogleDesktop\gdiplus\gdiplus.dll" "%ProgramFiles%\google\Google Desktop Search\"
      And make it a computer startup script, cause members of the local users group are not allowed to write in the program Files folders.

      Last edited by Rems; 6th January 2007, 16:20.

      This posting is provided "AS IS" with no warranties, and confers no rights.


      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts


      • #4
        Re: Problem with Xcopy in Startup script

        I want to thank the original poster, ccook13, for doing what is expected -- posting a good, thorough desciption of the situation.

        Lately I (and others) have been finding initial posts to be lacking in all that the forum rules request. So it is SOOOOO refreshing to see a well constructed post.

        To ccook13:

        In the way-back-machine, .BAT files ran under Command.exe and .CMD files ran under CMD.exe. Don't believe that's the case these days but do rename the script to .CMD just for me

        If sorinso's suggestion is not diserable / workable for you, can you live with the initial warning as CMD.EXE doesn't like running from a UNC?

        If Rems' suggestion doesn't work for you, try COPY as it may work better for a single file and does support the /Y option and probably won't think about the file vs. directory issue.

        Reputation all the way around (4 pts is all I can give).

        Off topic to Moderators / Admins:

        We really do need to implement some checkpoints / safeguards to ensure initial posts are more like this one and less like many I've seen since late December.


        ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

        2006-2099 R Valstar. This post is offered "as is" for discussion purposes only with no express or implied warranty of any kind including, but not limited to, correctness or fitness for use. Nothing herein shall be construed as advice. Attempting any activity based on information in this post is done at your own risk.


        • #5
          Re: Problem with Xcopy in Startup script

          Originally posted by rvalstar View Post
          In the way-back-machine, .BAT files ran under Command.exe and .CMD files ran under CMD.exe. Don't believe that's the case these days but do rename the script to .CMD just for me
          CMD.EXE is the 32-bit shell since NT, and replaces the old 16-bit COMMAND.COM from 9X and ME.
          CMD.EXE works both with .CMD and .BAT extensions, the old one only with .BAT . People are still writing BAT files, but they are supposed to write CMD files. BTW, one way to be certain a file will not be run on an older system is to use .CMD extension.
          You can see what you're using (and thus, knowing on what system you are) by checking the COMSPEC environment variable.
          BTW, I read somewhere that there's a difference between the length of the command line on XP and the older OSes.
          Yeap (d quickly ): 8191 characters in XP and only 2047 in 2000 and NT.

          I join you, Rick in your thank to ccook13. I'll add some reputation myself.

          Sorin Solomon

          In order to succeed, your desire for success should be greater than your fear of failure.


          • #6
            Re: Problem with Xcopy in Startup script

            It works!

            Thanks to all who replied - Sorinso, Rems and Rvalstar.

            Here's the script I ended up using in a CMD file:
            net use q: "\\DS2\Network Services\GoogleDesktop"
            mkdir "%ProgramFiles%\google\Google Desktop Search"
            xcopy /Y q:\gdiplus\gdiplus.dll "%ProgramFiles%\google\Google Desktop Search\"
            net use q: /delete
            I've added to points to everyones reputation since all the comments were helpful.