Link to home
Start Free TrialLog in
Avatar of jamil Mohammad
jamil Mohammad

asked on

how to open C drive from network PC

i tried to user the below command via batch script file

START \\%computer%\C$ /user:%username% %Password%

but every time it keep asking for the username and password.
is their any way that i can get it to open the C drive for any computer that i input in the batch file

note: i input in the batch file the username and password and PC name
so i use %username% and %password% and %computer% from my input when i run the batch file.

any advise?
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Hi Jamil,

NET USE will allow you to map and unmap a shareable drive with a batch script.

:: Connect drive as G:
NET USE G: \\computername\sharename
:: The sharename is available locally as drive G:

::  Delete the connection to G:
NET USE G: /DELETE

Kent
You may need to (probably need to) share the target drive / folder to the user name trying to access it. It the network user name is different from the target machine, you may need to add the network user name and password to the target machine.

Make sure in Network Sharing Advanced Properties that User names and passwords are required. Disables home group.
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jamil Mohammad
jamil Mohammad

ASKER

i have tried what Shaun Vermaak advised as the below syntax but it didn't work --> the Option /Password xxxxxxxx is unknown!
NET USE \\%computer%\ipc$ /user:%username% %Password%
\\%computer%\C$

it's not mandatory to assign a drive letter for net use.
but when i use START \\%computer%\C$  it pop up a new windows explorer and asking for login username and password.
now i need the same way but to open automatically by getting the username and password from my input in the batch file.

the idea is that i need from my PC to open overy 500 network computers C drive to do a task related to software installation and some other tasks.
i want this batch to work perfectly without asking to login for each computer C,,,, it will be a pain
any idea?
i have tried what Shaun Vermaak advised as the below syntax but it didn't work the Option /Password xxxxxxxx is unknown!
I did not say use /Password
NET USE \\SomeComputer\ipc$ /user:Administrator Password1
\\SomeComputer\C$

Open in new window

i didn't used /password,
this is the error message only when i copy past your advised code syntax.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial