Windows mount network share to drive commnad line (thorugh a script) except "net"

Ashwan 536 Reputation points
2021-12-09T03:28:32.6+00:00

Hi I am looking to mount network share through my script and I am unable to use "net use" commands since net used 445 port due to the security reason.
therefore I am looking alternative command to replace following command with net
C:>net use v: \wintestsrv01\S$

any help please

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,926 Reputation points
    2021-12-09T14:11:14.923+00:00

    Hello @Ashwan

    A mapped drive is simply an alias for a UNC (Universal Naming Convention)
    name. So just use the UNC name instead. If drive
    "Z:" is mapped to \ServerName\ShareName then the command:

    copy YourFile Z:\SomeFolder

    is the same as:

    copy YourFile \ServerName\ShareName\SomeFolder

    More: if you
    have \server\share mapped to d: and would normally copy to the filename
    "d:\myfile.dat", instead use the filename "\server\share\myfile.dat"

    Hope this helps with your query!

    ----------

    --If the reply is helpful, please Upvote and Accept as answer--


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.