Translate file name in mapped drive to unc path filename
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello! Which function translates file name given in mapped drive path to file name given in UNC path? For example: z:/abc/test.m to //nettapp1/abc/test.m Thanks in advance!!
3 comentarios
dpb
el 28 de Jun. de 2022
" I know there is a Matlab function which does this automatically..."
I don't believe there is any such thing in base MATLAB. Maybe somebody has posted something on FEX, but unless there's a java method (and I don't know that there is), capturing the output from NET USE is the ticket for a Windows box.
Respuestas (1)
Jan
el 29 de Jun. de 2022
No, there is no Matlab command to perform this automatically.
net use sovles this and WMIC can help also:
[status, out] = system('wmic path win32_mappedlogicaldisk get deviceid, providername');
List = strsplit(out, '\n');
Line = List{startsWith(List, 'Z:')};
UNC = strtrim(Line(3:end));
Or parse the output of the PowerShell command:
Get-WmiObject Win32_NetworkConnection | where -Property 'LocalName' -eq 'Z:' | ft "RemoteName","LocalName" -A
0 comentarios
Ver también
Categorías
Más información sobre Search Path en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!