Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

set a variable based on a user input

I am going mad.....

I am in no way a scripter, in fact, i am about as far away from a programming mind as the earth is from the sky so bare with me! hopefully this is simple

i have never scripted a thing in my life until a fortnight ago, nd jumped in at the deepend - decided to script my Active Directory Structure...... surprisingly enough, with much yelling, screaming and cursing i have got 95% of it complete even with variables cranking along! woohoo!!

now what i am struggling with is how to base a Variable, on user input

ie, i want my scirpt to when run prompt for a number for example, box pops up, says enter number and then the value that is entered becomes the value of the variable! i thought this would be easy so jumped onto google and experts and found nothing worked for me.

i have tried this  ===== set /p StoreNo=Please enter your Store Number: ===== to try and get it and declared the StoreNo Variable at the top of my script, however i run it and it errors right off!

i know there is something i am missing here and you guys will probably have a good laugh at my ignorance, but i have no idea and most of my script is copy, paste, edit!

i would like three different variables specified by user input when the script is run :) Please help me I am a networker and thats it!
0
Jay_Jay70
Asked:
Jay_Jay70
  • 3
  • 3
1 Solution
 
bruintjeCommented:
Hello Jay_Jay70,

assuming you use vbs you could start with something like this in a notepad and save it as test.vbs then run it and it will popup 3 boxes for user input

'---------
dim strVar1, strVar2, strVar3

strVar1 = InputBox("Enter a number")
strVar2 = InputBox("Enter a name")
strVar3 = InputBox("Enter a text")

' now check if the number is a number
if IsNumeric(strVar1) Then
  ' do something
Else
  ' do something else
  MsgBox "No valid entry for number"
End If
'---------

for samples for your topic you could look at
source: http://www.computerperformance.co.uk/Logon/index.htm
source: http://www.microsoft.com/technet/scriptcenter/resources/qanda/ad.mspx

hope this helps a bit
bruintje
0
 
Jay_Jay70Author Commented:
you my friend, are a legend!

dont know why i didnt post here 3 days ago, i am a regular and didnt even think about it!

Thankyou very much :)

is there any way to make that input box look any different or is that the default??
0
 
bruintjeCommented:
:)

default properties of the box are

InputBox (prompt, title, default, xpos, ypos)

so you could also use something like
InputBox ("Enter a number", "Number input", "5", 100, 100)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Jay_Jay70Author Commented:
good man :)
0
 
bruintjeCommented:
thanks for the grade and helping so many people around here :)
0
 
Jay_Jay70Author Commented:
and the same to you, your profile is huge! well done, its no small achievement reaching genius & wizard levels in multiple TA's
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now