我知道必须有一个简单的答案,但我怎样才能同时运行我的两个命令?我可以运行一行来创建新目录并命名,然后将项目从一个文件夹复制到另一个文件夹。但是,如何创建文件夹并将文件复制到该创建的文件夹中?在PowerShell中结合使用两个命令
#Creates new directory and names it current date and time.
New-Item C:\ -type directory -Name ("$(Get-Date -f ddMMyyyy_hhmm)")
#Copies Data from one directory to another, works good.
Copy-Item C:\test\* C:\test2
感谢您的帮助。
你只是想让命令成为单行还是你想让它一步完成? –
如果可以在一行中做得很好,但因为我今天开始使用power shell,所以我写出了伪代码,并在msdn站点上花了很多时间。 – Frater