dir & cd ..
Show dir output and change directory.
Shows Get-Job output and changes directory.
PS C:\programas> dir & cd .. Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
7 Job7 BackgroundJob Running True localhost Microsoft.PowerShell.Man…
Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
&
as a suffix is the Background Job Operator in PowerShell, it uses Start-ThreadJob
to kick off a background job in another runspace.
If you want to execute commands in sequence, you can end a statement with ;
to execute both:
dir ; cd ..
@vexx32
Background Job Operator & creates a background job, not a thread job.
I see, thanks for the infos! I came from batch so didn't know that :D
@Ronkiro you might find PSKoans a useful resource. 🙂
Most helpful comment
&
as a suffix is the Background Job Operator in PowerShell, it usesStart-ThreadJob
to kick off a background job in another runspace.If you want to execute commands in sequence, you can end a statement with
;
to execute both: