Solved

Combine Vars in Powershell into new Var

Posted on 2011-03-17
3
648 Views
Last Modified: 2012-06-22
I am trying to combine variables in a script into a single varilabe.

So say My Script has set:
$a =1
$b =hello
$c = World

I want my $result to be "1 hello World"

I tried things like
$result = $a $b $c

So I can just call on $result

Extra credit how do I set the $result to be "1.hello world!"

Thanks
0
Comment
Question by:brittonv
3 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 35161480
 $a ="1"
 $b ="hello"
 $c ="World"
 $result = $a + " " + $b + " " +$c

Open in new window

 $a ="1"
 $b ="hello"
 $c ="World"
 $result = $a + "." +$b + " " +$c + "!"

Open in new window

0
 
LVL 8

Author Closing Comment

by:brittonv
ID: 35161714
THANK YOU!!!!
0
 
LVL 13

Expert Comment

by:soostibi
ID: 35163777
Or more "powershellish" solution:

$result = "$a $b $c"

and

$result = "$a.$b $c"
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now