1

ファイルをローカル ディレクトリからチーム ドライブに移動するのに苦労しています。

PS から離れて別のルートを探すことを余儀なくされるかもしれないと感じています。

このコマンドは機能しません:

Move-Item -Path 'C:\Program Files (x86)\FieldSmart View\Logs\BgSync.log' -Destination 'G:\Team Drives\LGE Prints\Logs\$env:computername.txt'

このコマンドは動作します:

Move-Item -Path 'C:\Program Files (x86)\FieldSmart View\Logs\BgSync.log' -Destination C:\Users\ITAdmin\Desktop\Test\$env:computername.txt

唯一の違いは目的地です。

ファイルをチーム ドライブに移動しようとすると、次のエラーが返されます。

Move-Item : 指定されたパスの形式はサポートされていません。

行:1 文字:1

  • Move-Item -Path 'C:\Program Files (x86)\FieldSmart View\Logs\BgSync.l ...

  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~

  • CategoryInfo : NotSpecified: (:) [Move-Item], NotSupportedException

  • FullyQualifiedErrorId : System.NotSupportedException,Microsoft.PowerShell.Commands.MoveItemCommand

私に何ができる?

4

1 に答える 1

0

私の推測では、文字列で変数の置換が必要な場合は、二重引用符ではなく一重引用符を使用していると思います。2番目の例には引用符がなく、コマンドラインはその「テキスト」を置換付きの文字列に変換します。

これを実行します:

"single"
'G:\Team Drives\LGE Prints\Logs\$env:computername.txt'

"double"
"G:\Team Drives\LGE Prints\Logs\$env:computername.txt"

このリンクは良さそうです。または、他のvariable replacement.

https://kevinmarquette.github.io/2017-01-13-powershell-variable-substitution-in-strings/

于 2018-10-18T02:46:37.317 に答える