Using Scripting.FileSystemObject
I can get the full path name of a file, but this will always be like "c:\temp\myfile.txt". How can I get the name of the PC, or a network-path to the file like \MyPC\temp\myfile.txt? Is there another class other than Scripting.FileSystemObject
I can use?
In Windows, if you have mapped network drives and you don't know the UNC path for them, you can start a command prompt (Start → Run → cmd.exe) and use the net use command to list your mapped drives and their UNC paths: C:\>net use New connections will be remembered.
Hold Shift down and right-click on the file and select "Copy as path". Insert a Hyperlink in the email and paste in the address field of the Hyperlink dialogue box. After you create the hyperlink in the email, you're done. The link will show the mapped drive letter this is true.
They indicate that the path should be passed to the system with minimal modification, which means that you cannot use forward slashes to represent path separators, or a period to represent the current directory, or double dots to represent the parent directory.
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
strComputerName = wshNetwork.ComputerName
WScript.Echo "Computer Name: " & strComputerName
Source: http://www.robvanderwoude.com/vbstech_network_names_computer.php:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With