获取计算机名称并根据结果重命名文件
我想在启动上运行一个Power Shell脚本,该脚本将查询本地主机名并通过插入结果重命名本地文件。
例如,使用以下内容获取主机名
$(Get-WmiObject Win32_Computersystem).name
,并将结果插入命名和位于下面的文件中,
C:\output\file-from-`Insert hostname`.txt
使用get-wmiObject
将其命名为我粘贴的现有文件的结果和。
任何帮助都会很棒。
:-)
I'd like to run a Power shell script on start up that will query the local hostname and rename a local file by inserting the result.
For example, get hostname using something like:
$(Get-WmiObject Win32_Computersystem).name
..and insert the result into a file named and located as below,
C:\output\file-from-`Insert hostname`.txt
Its using the result of the Get-WmiObject
to rename the existing file that I'm stuck with.
Any help would be great.
:-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该解决问题。
This should do the trick.