1

Is there a PowerShell equivalent of the vbscript "with" statement? e.g.

With MyLabel
   .Height = 2000
   .Width = 2000
   .Caption = "This is MyLabel"
End With
mklement0
  • 382,024
  • 64
  • 607
  • 775
  • 4
    Does this answer your question? [The With statement in the VBS code, how expressed in PowerShell](https://stackoverflow.com/questions/56459455/the-with-statement-in-the-vbs-code-how-expressed-in-powershell) or [Setting multiple properties at once - equivalent of VB's With statement to provide an implied object context](https://stackoverflow.com/q/42378637/150605) – Lance U. Matthews Aug 18 '20 at 19:21
  • 1
    In short: there's no equivalent feature. In the common scenario of object initialization with many property values, PowerShell's type conversion magic usually makes it pretty easy to write in compact ways. – Mathias R. Jessen Aug 18 '20 at 19:33

0 Answers0