首页 > 解决方案 > 将文本文件中的内容添加到变量内容的末尾

问题描述

这是我的代码:

$tt = 'HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows 消息子系统\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676'

我有一个txt文件c:\temp\reg.txt twxt文件的内容是:

00000005

然后我想将文本文件中的内容添加到变量的末尾,以便 $tt 将更新为

'HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows 消息子系统\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\00000005'

我不知道该怎么做,或者如果你可以。

谢谢您的帮助

标签: powershell

解决方案


像在 Unix 上一样使用命令替换:$x = "bla bla $(cat file.txt)"


推荐阅读