Jump to content

Long UNC path not working in CMD.EXE on remote machine


Recommended Posts

Hi,

I am trying to connect to a remote server using Plink tool. Both my local and remote machines are Windows. On remote server, I have OpenSSH server installed. I am able to run commands on remote machine but there is some problem with long UNC path, which I noticed today.

For example,

--------------------------------------------------------------

Working:

Plink -ssh -pw xxx user@server cmd.exe /c copy //test//somedir//inside//some.exe //test//another//

Not Working:

Plink -ssh -pw xxx user@server cmd.exe /c copy //test//somedir//inside//more//prog.exe //test//another//

When I did echo to see how it's interpreting the command, I saw the following output:

.....//test//somedir//inside//mo //test//another//

As you can see above, it's not working if the sub-directory level increases above 2. It just prints the first two characters of the third directory (here 'mo' for directory name 'more').

--------------------------------------------------------------

This doesn't look like the 8-character DOS issue because the real path that I am using has the first directory containing 11 characters. I am not sure whether it's a limitation of Plink tool or command shell or something else.

By the way, my script takes the UNC path as input from the user. It can contain any no. of sub-directory levels. I think it should not exceed more than 8-9 levels in any normal case but it'll be better if the solution works for any arbitrary levels.

I have thought of mapping the UNC path to some drive letter but I want to explore some other alternative (short & sweet). I think, implementing mapping might involve a good deal of work.

Can anyone suggest a way to overcome this problem?

Thanks,

GC

Link to comment
Share on other sites

I was trying to see whether mapping the UNC path to a drive letter on the same machine (where UNC is pointing to) works. I tried using SUBST command for the same, but to no avail. I do not get any error message after I execute the command but when I check the remote server, I am not able to see the virtual drive that I assigned to the UNC path.

plink -ssh -pw xxx admin@server cmd.exe /c subst v: '\\\server\use'

[ignore the triple slashes; they work with Plink.]

I also tried using the actual path, but again it did not work.

plink -ssh -pw xxx admin@server cmd.exe /c subst v: 'H:\use'

After I run the above command, I cannot see v: drive on the server.

Any pointers/help?

Regards,

GC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy