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


 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions Long UNC path not working in CMD.EXE on remote machine
# 1  
Old 07-21-2010
Long UNC path not working in CMD.EXE on remote machine

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:
Code:
Plink -ssh -pw xxx user@server cmd.exe /c copy //test//somedir//inside//some.exe //test//another//

Not Working:
Code:
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
# 2  
Old 07-23-2010
Idea
1) Create a Batch File on the local computer based on the user's parameters
2) Copy the Batch File to the remote computer
3) Execute the Batch File.
# 3  
Old 07-25-2010
Thanks methyl! I tried your method on one of my test server; it's working. I am at home so could not try on the main server.

By the way, before your reply came, 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.
Code:
 
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.
Code:
plink -ssh -pw xxx admin@server cmd.exe /c subst v: 'H:\use'

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

Any pointers/help?


Regards,
GC

Last edited by Technext; 07-25-2010 at 07:49 AM..
# 4  
Old 07-25-2010
All I can suggest is to try to reverse the "subst".

Code:
subst v: /D

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with fetching the data from remote machine from my jumpbox(local machine)

Team, Presently i am running a script from my local box(i.e jumpbox) to all the remote machines.Basically fetching basic queries like pwd,mkdir,touch etc and i am able to successfully fetch it from my local machine.But when i want to check certain database related queries like the dbstat... (20 Replies)
Discussion started by: whizkidash
20 Replies

2. Red Hat

iptables applied in local machine, can't ssh remote machine after chain changed to DROP

I want to SSH to 192.168.1.15 Server from my machine, my ip was 192.168.1.99 Source Destination was UP, with IP 192.168.1.15. This is LAN Network there are 30 Machine's Connected to the network and working fine, I'm Playing around the local machine's because I need to apply the same rules in... (2 Replies)
Discussion started by: babinlonston
2 Replies

3. Windows & DOS: Issues & Discussions

Close CMD after opening multiple exe's with it ?

Current code: cd "PATH" cmd /c "EXE1.exe" "EXE2.exe" Problem: The Command line stays open after opening the second executable. I would need a way to open multiple programs and automatically close the command line after they have been opened. Thanks in advance: pasc (14 Replies)
Discussion started by: pasc
14 Replies

4. UNIX for Advanced & Expert Users

FTP While transfering files to local machine to remote machine

Hi Am using unix Ksh Am getting the problem while transferring zero size files through the script . When i transfer zero size files from local machine to remote machine manually i can able to do it . My question its beause of zero size files am not able to transfer through script ? or its... (2 Replies)
Discussion started by: Venkatesh1
2 Replies

5. Shell Programming and Scripting

Parse file name out of UNC path

Hello, I searched the forums and didn't see a situation like this: I cannot figure out how to parse out just the file name from the full path. The path looks like this: \\foo\bar\filename.ext I don't think something like 'cut' will work so I tried to whip up a regex but couldn't get it... (12 Replies)
Discussion started by: bytesnoop
12 Replies

6. Shell Programming and Scripting

Library on Remote machine or $PATH is not working..

I don't know how to put this. However here is the problem. While executing command remotely on a Unix machine i get an error /usr/lib/hpux32/dld.so: Unable to find library 'libxerces-c.sl.21'. However when i execute the command on the remote machine locally. it works fine. Also i have... (2 Replies)
Discussion started by: suraj.sheikh
2 Replies

7. Windows & DOS: Issues & Discussions

How to know machine details in windows through cmd

Hi, I want to print machine details in windows. In UNIX it is easily available by the command uname -X Is there any command like this in windows to get those details.. can anybody help me on this.. Thanks in advance. ~arup (1 Reply)
Discussion started by: arup1980
1 Replies

8. Red Hat

To find the LATEST file from a dir on REMOTE machine and SCP to local machine?

Hi All, URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
Discussion started by: me_ub
3 Replies

9. UNIX for Dummies Questions & Answers

Link type between working machine and server machine

There are two servers where my machine is connected. Is there any type of link formed between my machine and server machine? (1 Reply)
Discussion started by: palash2k
1 Replies
Login or Register to Ask a Question