1
私は、フォルダを作成し、ローカルマシン上の指定されたフォルダからすべてのテキストファイルを新しいフォルダにコピーするスクリプトを作成しています。私は、フォルダを作成していますが、私はこれがどうなるフォルダから新しいフォルダにファイルをコピーする
$destDir = Read-Host -Prompt 'Please enter the new folder name: '
# Check if the folder exist if not create it
$dir = $destDir
if(!(Test-Path -Path $dir)){
New-Item -ItemType directory -Path $dir
Write-Host "New folder created"
}
else
{
Write-Host "Folder already exists"
}
# Check if the folder exist if not create it
If (!(Test-Path $destDir)) {
md $dir
}
}
あなたは 'GET-を使用することができますChildItem'で、あなたが望むテキストファイルをフィルタリングして 'Copy-item'にパイプします。 – BenH
[これは?](http://stackoverflow.com/questions/16004984/powershell-command-to-copy-only-text-files ) –