Page 1 of 1

I need some help here..

Posted: 11 Jul 2007 03:25
by Jugg
Hi guys. First post here.

ive got this major problem, because of people quitting, im the only person in the computer department, at a company with more than 600 employes, so im in deepshit right now because of the huge amount of work.

I havent written much in batch so i come here asking for a favor(Please Don Corleone), can someone make this script:

It has to start by asking 2 things; Name and pass.

That information should be turned into this:

net use Z: \\sosu-srv\"name" /user:"Name" "Pass" /persistent:yes

I would really really appreciate this, since im currently working 10-12 hours a day, and i just can do any more than that...

The only thing i can offer for this help, is that i can help you if you got problem with either linux or unix or applications to those platforms.

Posted: 11 Jul 2007 05:47
by Jugg
Or just tell me how i use variables in batch

Posted: 12 Jul 2007 10:10
by Mark_B
try this to see if it works :


@echo off

set /p name=Please Enter your name :
set /p pword=Please Enter your password :

echo net use Z: \\sosu-srv\%name% /user:%name% %pword% /persistent:yes

Posted: 12 Jul 2007 10:12
by Mark_B
oops forgot to take out the echo in front of the last line! at the moment all it will do will print the command on the screen ... to make it actually do it take out the word echo.

Variables are easy to use in batch scripting, define them using SET and use them with % around them.

in the example i gave you, i used set /p which prompts the user for an entry, but you can use a straight :

set <var name>=<value>

then using them is just a case of %<var name>%.

hope that helps.