Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In cmd prompt, you can run two commands on one line like so:

ipconfig /release & ipconfig /renew

When I run this command in PowerShell, I get:

Ampersand not allowed. The & operator is reserved for future use

Does PowerShell have an operator that allows me to quickly produce the equivalent of & in cmd prompt? Any method of running two commands in one line will do. I know that I can make a script, but I'm looking for something a little more off the cuff.

share|improve this question
Fun Note: Between Serial ports and Serialisation, this question is virtually impossible to search for. – David Jun 26 '13 at 17:25
To be nerdy... It's very easy to search for it. It's just quite hard to get a relevant set of hits. :) (+1 for great question) – Konrad Viltersten Jun 27 '14 at 16:01
up vote 81 down vote accepted

Use a semicolon to chain commands in powershell:

ipconfig /release; ipconfig /renew
share|improve this answer
Will they run in parallel or sequentially? – Tarkus Jul 16 '14 at 1:13
This will run them sequentially, as does the & operator in cmd.exe. – Squeezy Jul 23 '14 at 5:38
There is big difference though - ";" runs the second command even if the first fails. – Ivan Oct 8 '14 at 16:50
As mentioned above, this is also the behavior of & in cmd.exe. – Squeezy Oct 8 '14 at 16:53
The second command won't run if the first throws a terminating error. In <throw "error";write-host "no error">, "no error" is never written to the console. – Dave_J Jul 22 '15 at 10:59

A semi colon will link the commands as the previous answer stated, although there is a key difference to the behaviour with the & operator in the MS-DOS style command interpreter.

In the command interpreter, the variable substitution takes place when the line is read. This allows some neat possibilities such as swapping variables without an interim:

set a=1
set b=2
set a=%b% & set b=%a%
echo %a%
echo %b%

Would result in:


As far as I know, there is no way to replicate this behaviour in Powershell. Some may argue that's a good thing.

Edit: There is in fact a way to do this in Powershell: $b, $a = $a, $b Will result in a single line swapping of the variable values

share|improve this answer
$b, $a = $a, $b cool! :) – Tarkus Jul 16 '14 at 1:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.