$info = Invoke-SQLCmd -ServerInstance $Server -Database $Database -inputfile "$queriespath/compare_quantity.sql"
$changes = $info.length
for($i=0; $i-le$changes; $i++) {
$text = "Revise,$info[$i].quantity,$info[$i].itemid" | Set-Content 'C:\Users\pmaho\Dropbox\SAMPOWERSPORTS\CustomChrome\revision.txt'
}
我试图将$ info [$ i] .quantity,$ info [$ i] .itemid的值写入文件。将变量写入文件
这是我的代码输出现在 修改,的System.Data.DataRow的System.Data.DataRow [2] .quantity,的System.Data.DataRow的System.Data.DataRow [2] .itemid
我想要说出可变物的实际价值,我该怎么做?
编辑:
for($i=0; $i-le$changes; $i++) {
$text = $($info[$i].quantity) | Set-Content 'C:\Users\pmaho\Dropbox\SAMPOWERSPORTS\CustomChrome\revision.txt'
}
上面是打印什么。
的可能的复制[?你怎么能在一个字符串中使用一个对象的属性(http://stackoverflow.com/questions/ 1145704 /如何使用一个对象属性在一个字符串) – briantist
该帖子没有帮助。我正在尝试使用括号,并且无法正确识别 –
通过将它放入问题中告诉我们你在做什么。 – briantist