I need some help here..

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Jugg
Posts: 2
Joined: 11 Jul 2007 03:10

I need some help here..

#1 Post by Jugg » 11 Jul 2007 03:25

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.

Jugg
Posts: 2
Joined: 11 Jul 2007 03:10

#2 Post by Jugg » 11 Jul 2007 05:47

Or just tell me how i use variables in batch

Mark_B
Posts: 3
Joined: 12 Jul 2007 10:08

#3 Post by Mark_B » 12 Jul 2007 10:10

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

Mark_B
Posts: 3
Joined: 12 Jul 2007 10:08

#4 Post by Mark_B » 12 Jul 2007 10:12

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.

Post Reply