Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-7920

Access denied when copy files from a network computer in Windows batch script

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • core
    • None

      I have a problem (Access is denied) when I try to copy files across network in a Windows batch script.

      Hudson will call a script, say, a.bat and inside a.bat I have the followings

      ...
      setlocal ENABLEDELAYEDEXPANSION
      ...
      
      if DEFINED abc (
         set xyz=\\computer\path
         set filename=mm*.dll
      
         copy /Y !xyz!\!filename!   
      )
      ...
      endlocal
      

      The 'copy' command will fail and I Google for the problem but there's no particular one. There's one paper saying UNC should be used (http://stackoverflow.com/questions/1284561/hudson-continuous-integration-server-how-to-see-windows-mapped-directories-that). So I did the following experiments:

      1) set xyz="//computer/path"
         ...
         copy /Y "!xyz!"\!filename!
      2) ...
         copy /Y "//computer/path"\mm*.dll
      

      The 1) doesn't work and produces the same problem - "Access is denied." but the 2) is working. However, copy /Y "//computer/path"!file_name! won't work either.

            Unassigned Unassigned
            bakerzhang bakerzhang
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: