Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comspec command & problems using variables

Status
Not open for further replies.

pghsteelers

Technical User
Apr 21, 2006
121
US
I am trying to use the Comspec command to issue a network command. But if I wanted to request input from the user and then use that input which is assigned to a variable in a command line, how do I do that.

For example, I read in input from the user to variable and put that in something like

var = something
objshell.Run "%comspec% /k c: & cd & c:\ & cls & cd c:\ & nbtstat -a (here is where I would like to place the variable".

I know with allot of functions we can adjoin them using the & such as:

objshell.Run "%comspec% /k c: & cd & c:\ & cls & cd c:\ & nbtstat -a" & var

but this doesn't work. Any ideas?
 
Perhaps this ?
objshell.Run "%comspec% /k c: & cd c:\ & cls & nbtstat -a " & var

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Geez, so i was doing it right, I just didn't have a space between the -a and the "

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top