有一个要求,我需要将在 powershell 中设置的变量传递给另一个变量
请找到以下示例
PS D:\temp\arun> $match1=get-date -format ddMMM
PS D:\temp\arun> $match1
19Jun
test.txt 文件有以下内容
19Jun1
19Jun2
19Jun3
PS D:\temp\arun> $match2=select-string -simple 19Jun test.txt
PS D:\temp\arun> $match2
19Jun1
19Jun2
19Jun3
但是当我试图传递变量时,我没有得到结果。
PS D:\temp\arun> $match2=select-string -simple $match1 test.txt
PS D:\temp\arun> $match2
有人可以帮我吗?