如何将此路径与此变量连接起来?
$file = "My file 01.txt" #The file name contains spaces
$readfile = gc "\\server01\folder01\" + ($file) #It doesn't work
Run Code Online (Sandbox Code Playgroud)
谢谢
创建数组,哈希表和字典的正确方法是什么?
$array = [System.Collections.ArrayList]@()
Run Code Online (Sandbox Code Playgroud)
$array.GetType() 返回ArrayList,好的.
$hashtable = [System.Collections.Hashtable]
Run Code Online (Sandbox Code Playgroud)
$hashtable.GetType() 返回RuntimeType,不行.
$dictionary = ?
Run Code Online (Sandbox Code Playgroud)
如何使用这种.NET方式创建字典?
字典和散列表有什么区别?我不确定何时应该使用其中一个.
我有一个脚本,有一些命令,如Write-Host "Server1".如何将其导出到文件?
当我尝试script > export.txt它时,它没有用.
这是我的代码:
Write-Host "Field 1 : " $variable1
Write-Host "Field 2 : " $variable2
Write-Host "Field 3 : " $variable3
Write-Host "Field 4 : " $variable4
Run Code Online (Sandbox Code Playgroud)
我得到如下输出:
Field 1 : " $variable1
Field 2 : " $variable2
Field 3 : " $variable3
Field 4 : " $variable4
Run Code Online (Sandbox Code Playgroud)
我怎样才能对齐它们?
谢谢