Using proper inverted commas, instead of apostrophe?

I have the following example which I'm using for PowerShell. I need to use inverted commas and I'm unsure how to achieve this?

If I leave the following '" + a + "' then it results in 'variable' or in this case, 'username'
If I remove the apostrophe, i.e. " + a + " it results in the variable without the inverted commas
if I double the inverted commas, i.e. "" + a + "" the script fails to run

I need the output of a to present as: "variable" or in this example, "username" not 'username'

What am I missing?

<style>
 body {background-color: white;}
 a {color: yellow; font-size: 14px;font-family: verdana; background-color: navy;}
 define {color: navy; font-size: 13px; font-family: verdana; font-weight: bold;}  
 example1 {color: navy; font-size: 12px; font-family: verdana;}
</style>
<script>
function myFunction() {
    var a = document.getElementById("a").value;


//Get User Properties - Brief	
	pText = "<span style='color: grey;font-size: 75%;font-family: verdana;'>Get-ADUser '" + a + "'</span>";
//Get User Properties - General
	pText = pText + "</br><span style='color: grey;font-size: 75%;font-family: verdana;'>Get-ADUser '" + a + "' -Properties *</span>";
	document.getElementById("Powershell").innerHTML = pText
//Get User Properties - All	
	pText = pText + "</br><span style='color: grey;font-size: 75%;font-family: verdana;'>Get-ADUser '" + a + "' -Properties * | Select *</span>";
	document.getElementById("Powershell").innerHTML = pText
}
</script>
<body>

<font font size="4" face="verdana" color="blue">Powershell: ADUser</font><p>
<p><input type="text" id="a" size="23" maxlength="90" style="font-family: Verdana; font-size: 10; color: #6600FF" value="user.name";"></p>

<button onClick="myFunction()">Generate</button>
<p id="Powershell"></p>

Open in new window

Mike DiasAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
You can place double quotes in a text string by escaping them with a backslash.  Is this what you are looking for perhaps?

<style>
 body {background-color: white;}
 a {color: yellow; font-size: 14px;font-family: verdana; background-color: navy;}
 define {color: navy; font-size: 13px; font-family: verdana; font-weight: bold;}  
 example1 {color: navy; font-size: 12px; font-family: verdana;}
</style>
<script>
function myFunction() {
    var a = document.getElementById("a").value;

//Get User Properties - Brief	
	pText = "<span style='color: grey;font-size: 75%;font-family: verdana;'>Get-ADUser \"" + a + "\"</span>";
//Get User Properties - General
	pText = pText + "</br><span style='color: grey;font-size: 75%;font-family: verdana;'>Get-ADUser \"" + a + "\" -Properties *</span>";
	document.getElementById("Powershell").innerHTML = pText
//Get User Properties - All	
	pText = pText + "</br><span style='color: grey;font-size: 75%;font-family: verdana;'>Get-ADUser \"" + a + "\" -Properties * | Select *</span>";
	document.getElementById("Powershell").innerHTML = pText
}
</script>
<body>

<font font size="4" face="verdana" color="blue">Powershell: ADUser</font><p>
<p><input type="text" id="a" size="23" maxlength="90" style="font-family: Verdana; font-size: 10; color: #6600FF" value="user.name";"></p>

<button onClick="myFunction()">Generate</button>
<p id="Powershell"></p>

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike DiasAuthor Commented:
Perfect. Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.