Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Have any other users of Stata under Windows had problems with the shell command disallowing UNC paths?

    Fellow Statalisters

    I use the very latest Stata Version 16 (dated 11 Dec 2019) under Windows 10, and all of a sudden I find that I cannot really use the shell command any more in the way that I have always routinely taken for granted in the past. This is because, when I am using Stata in a current directory which is a networked drive and I type

    shell

    a Windows 10 CMD window opens and tells me that I cannot use the network drive as the current folder, because UNC paths are not supported as possible current directories, and changes the current directory to C:\Windows. An example of this behaviour is given below:

    **** BEGINNING OF CMD OUTPUT - CUT HERE
    '\\icnas4.cc.ic.ac.uk\rnewson\rnewson\projects\sme eton\pracnonparstats\ansmlatex'
    CMD.EXE was started with the above path as the current directory.
    UNC paths are not supported. Defaulting to Windows directory.
    Microsoft Windows [Version 10.0.17134.1184]
    (c) 2018 Microsoft Corporation. All rights reserved.

    C:\Windows>
    **** END OF CMD OUTPUT - CUT HERE


    This seems to be saying that Windows 10 no longer does as it is asked by Stata when a CMD window is initiated using a shell command, at least on my machine, because Windows 10 no longer allows the current folder to be a networked drive..

    I have encountered this behaviour from my machine before, both when launching a CMD window from Stata using shell and when opening a CMD window from within TextPad (my favourite text editor for Windows which comes with a Tools menu including "Command prompt window from current folder", which used to open a CMD window in the current folder but now makes a similar complaint about UNC paths not being supported. However, previously this behaviour would cease after I shut down my machine and restarted it again, after which UNC paths seemed to be supported again.. Now this no longer seems to happen, and Windows 10 still disallows UNC paths as the current folder, even after being restarted.

    I would guess that this problem is the fault of my Microsoft Windows 10 operating environment, and not of StataCorp. And, if I do a Web search on

    how-do-you-handle-cmd-does-not-support-unc-paths-as-current-directories

    I get advice either to use commands called pushd and popd in my shell script or to use a Microsoft-distributed utility called PowerShell. This seems to suggest that opening a CMD window under Windows 10 to execute an ordinary CMD shell script in the current networked folder is no longer thought to be a reasonable thing to expect to be able to do. But have any other Stata users under Windows 10 encountered this problem when they try to use the shell command in a networked current folder with a UNC path? And is there a non-drastic workaround?

    Best wishes

    Roger

  • #2
    My Windows version is slightly behind yours, but I can shell to a networked drive. Note my network drive is mapped. This works whether my current directory is at the root of the networked drive, or in a folder.

    Code:
    Microsoft Windows [Version 10.0.17134.1130]
    (c) 2018 Microsoft Corporation. All rights reserved.
    
    U:\>
    On a Windows server I also get:

    Code:
    Microsoft Windows [Version 10.0.14393]
    (c) 2016 Microsoft Corporation. All rights reserved.
    
    U:\Stata>
    If I switch to StataMP which happens to start in with an UNC specification, like you I get:

    Code:
    '\\sscwin\dfsroot\users\hemken\Documents'
    CMD.EXE was started with the above path as the current directory.
    UNC paths are not supported.  Defaulting to Windows directory.
    Microsoft Windows [Version 10.0.14393]
    (c) 2016 Microsoft Corporation. All rights reserved.
    
    C:\Windows>
    So my workaround would be to cd to a mapped specification before using shell.
    Doug Hemken
    SSCC, Univ. of Wisc.-Madison

    Comment


    • #3
      Hi Doug. Many thanks for this idea, which works for me too. I didn't tell you that I was using Stata/MP (sorry), but I was, and this feature seems to be specific to Stata/MP under the latest Windows 10. I will investigate a possible fix for the problem with running tools from TextPad.

      I don't recall ever having been treated quite this way even by a Windows upgrade (which seems to have to be a partial downgrade every time). And definitely not over the Xmas break, when I have normally got the most work done in the past...

      All the best

      Roger

      Comment


      • #4
        So it's not just the Americans?

        Doug Hemken
        SSCC, Univ. of Wisc.-Madison

        Comment

        Working...
        X