数组初始化的工作方式不同在powershell为什么PowerShell的考虑@()语法不同
$scripts = @(
("01", "a" , "01_Cleanup")
,("02", "b" , "02_Cleanup")
);
输出:
$scripts[0] - "01"
$scripts[1] - "a"
$scripts[2] - "01_Cleanup"
$scripts[3] - "02"
"b"
"02_Cleanup"
请数组初始化的通知 “”:
$scripts = @(
("01", "a" , "01_Cleanup"),
("02", "b" , "02_Cleanup")
);
输出:
$scripts[0] - "01"
"a"
"01_Cleanup"
$scripts[1] - "02"
"b"
"02_Cleanup"
为什么?由于不同的使用的
你贴的情况下,错误的输出;)无论如何,我认为这是因为一个事实,即没有迹象显示将继续在下一行。所以它将第一个数组视为单独的元素。但我也会对更简洁的答案感兴趣。 – 4c74356b41