将文件夹复制到LAN上的一系列计算机

时间:2015-06-24 17:37:39

标签: powershell

我想将文件夹复制到LAN上的一系列计算机上。以下是我到目前为止的情况:

$Computers = "Get-Content C:\Scripts\computers.txt"

$Source = "C:\Install\9_10_00_08HotFix_201504140001"
$Destination = "\\192.168.6.$\c$\Install"

ForEach-Object {
  Copy-Item -Path $Source -Recurse -Destination $Destination -Verbose -Force -ErrorAction SilentlyContinue
}

1 个答案:

答案 0 :(得分:0)

你没有说出你的实际问题是什么,但可能你错放了<?php /** * Template Name: Blog */ get_header(); get_template_part( "closer" ); ?> <div class="container"> <div class="row"> <div id="primary" <?php bavotasan_primary_attr(); ?>> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); get_template_part( 'content', get_post_format() ); endwhile; bavotasan_pagination(); else : get_template_part( 'content', 'none' ); endif; ?> </div> <?php get_sidebar(); ?> </div> </div> 声明中的第一个双引号,你不能像你那样定义一个可变目的地,而且你不能对你(试图)从Get-Content读取的内容做任何事情。

改变这个:

computers.txt

进入这个:

$Computers = "Get-Content C:\Scripts\computers.txt"

$Source = "C:\Install\9_10_00_08HotFix_201504140001"
$Destination = "\\192.168.6.$\c$\Install"

ForEach-Object {
  Copy-Item -Path $Source -Recurse -Destination $Destination -Verbose -Force -ErrorAction SilentlyContinue
}

并且您的代码应该可以使用。