title: Need to create dynamic folder in powershell and use it as a variable in copy-item
body: <p>I need to create a dynamic folder in power shell and copy some files to one more location.I am using the below script.</p>
  
  <pre><code>$fso = new-object -ComObject scripting.filesystemobject
  
  $fso.CreateFolder("d:\logs $(get-date -f yyyy-MM-dd-hh-mm-ss)")
  </code></pre>
  
  <p>I am trying to pass the above created folder path into a variable  and use it in copy item like below</p>
  
  <pre><code>$A=$fso.CreateFolder("d:\logs $(get-date -f yyyy-MM-dd-hh-mm-ss)")
  </code></pre>
  
  <p>and then </p>
  
  <pre><code>copy-item c:\logs $A
  </code></pre>
  
  <p>I am not sure what I am missing here,Can you please help me out,</p>