title: Get the last day of a month on powershell
body: <p>I'm trying to put in a <code>.txt</code> file the first day and the last day of the months using PowerShell.</p>
  
  <p>In the exemple below i was trying to get the first and the last day of July, but i'm just getting the first day. The second line of the script isn't working.</p>
  
  <pre><code>@PowerShell "(Get-Date).AddMonths(1).ToString('01/MM/yyyy')" &gt;&gt;dates.txt 
  $LastDayInMonthString = "$($(get-date).AddMonths(1).ToString("dd/mm/yyy"))$LastDayInMonth" &gt;&gt;dates.txt
  </code></pre>
  
  <p>Someone can say me what is wrong?</p>
  
  <p>I wanted a .txt file like it: <code>01/07/2018, 31/07/2018</code>.<br>
  The first line write the first day of next month,<br>
  and second line write the last day of that month.</p>