Re: CMD.exe batch for net use




"Richhall" <rje.hall@xxxxxxxxxxx> wrote in message
news:8625b882-7198-4f57-92aa-0881e3c200f8@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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?

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


.



Relevant Pages

  • Re: FTP Transfer
    ... REM Change Directory where the files to be transferred are. ... echo ftpusername> FtpScr.txt ... echo prompt>> FtpScr.txt ... REM lcd to change to the directory where the ...
    (microsoft.public.windows.server.scripting)
  • Re: Compiled ocx file reports different sizes
    ... Rem Set Resource Compiler path ... goto checkMIDL ... echo VC_HOME is set incorrectly. ... echo Step 2: Compiling Resource file ...
    (microsoft.public.vc.mfc)
  • Some batch files for applying MS03-026
    ... find all the Win2k systems. ... the patch to the remote system. ... REM * Author: ... Echo Querying the supplied list for Win2k systems. ...
    (microsoft.public.win2000.security)
  • RE: Help for Windows Vista.
    ... just add a username and password to your command. ... Echo Loggin into our company ... REM *** drev w ... Did you run the Script as Administrator? ...
    (microsoft.public.windows.vista.general)
  • Re: FTP Transfer
    ... echo ftppassword>> FtpScr.txt ... echo bin>> FtpScr.txt ... echo prompt>> FtpScr.txt ... REM files to be transferred are. ...
    (microsoft.public.windows.server.scripting)

Loading