Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Windows XP / General Topics 1 / May 2008

Tip: Looking for answers? Try searching our database.

CMD.exe batch for net use

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richhall - 21 May 2008 16:18 GMT
Apologies if I should be using msdos batch group.  I am using Widnows
XP and had a simple batch that had 3 variables at the prompt to create
a net use connection:

net use u: /d
rem *****************************************
rem %1 is IP address of target
rem %2 is username
rem %3 is password
rem -----------------------------------------
net use u: \\%1\c$ %3 /user:DOMAIN\%2 /PERSISTENT:NO
pause

However I want this to be run from a file not the command line.  I've
searched the group but can's see it without using 3rd party software
how I can prompt for the %1 etc.  I am not exactly sure what I am
doing, but got this far:

set /p IP=Enter Target IP:
set /p User=Username:
set /p Pass=Password:
echo %IP%
echo %User%
echo %Pass%
net use u: /d
rem *****************************************
rem %1 is IP address of target
rem %2 is username
rem %3 is password
rem -----------------------------------------
net use u: \\%1\c$ %3 /user:DOMAIN\%2 /PERSISTENT:NO
pause

How do I set the values entered in, as the %1, %2 and %3 values please?
Pegasus (MVP) - 21 May 2008 17:03 GMT
> Apologies if I should be using msdos batch group.  I am using Widnows
> XP and had a simple batch that had 3 variables at the prompt to create
[quoted text clipped - 30 lines]
>
> How do I set the values entered in, as the %1, %2 and %3 values please?

You're very close. Try this version:
@echo off
set /p IP=Enter Target IP:
set /p User=Username:
set /p Pass=Password:
echo %IP%
echo %User%
echo %Pass%
net use u: | find "\\" && net use u: /d
net use u: \\%IP%\c$ /user:DOMAIN\%User% %Password%
net use /PERSISTENT:NO
pause
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.