Entering a username into a Batch file.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What I'd like to do is move some files from a network location locally
over-night so that they're available to other programs.

The files I'm trying to move are simple .txt files, however on the network
location I need to enter a username and password.

How would I be able to send these 2 pieces of info (username / password) in
a batch file so I can access the location?

TIA.
 
DaveO said:
What I'd like to do is move some files from a network location locally
over-night so that they're available to other programs.

The files I'm trying to move are simple .txt files, however on the network
location I need to enter a username and password.

How would I be able to send these 2 pieces of info (username / password) in
a batch file so I can access the location?

TIA.

@echo off
set /p user=Please enter your logon name:
if "%user%"=="" goto Finish
set /p pw=. . . and your password:
if "%pw%"=="" goto Finish
(put your code here)
goto :eof

:Finish
echo.
echo Blank user name or password entered.
echo This program will now terminate.
echo Press the Space bar to close this window.
pause > nul
 
Thanks for the quick reply Pegasus.

I already know the username and password I want to use, but when try to
connect to the network location is comes up with a log-on box asking for them.

Can I still use your method to do this or as it's a input box, can I write
directly into it?

Thanks again.
 
Start a Command Prompt and type these commands to show
you how to use "net use":

net use /?
net help use

It will show you this:

net use s: \\YourServer /user:YourDomain\SomeUser SomePassword

It is, of course, a serious security risk to place passwords into
batch files.
 
Appreciate the thought Pegasus, but it's a short term fix to a problem I'm
having.

Thanks for the help.

DaveO.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top