Powershell 学习:第五章 使用其他提供程序 动手实验答案

1. 在注册表中,定位到 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer , 选中 "Advanced" 项, 修改DontPrettyPath的值为0.

set-location hkcu:

set-location Software\Microsoft\Windows\CurrentVersion\Explorer

Set-ItemProperty -Path .\Advanced\ dontprettypath -Value 0

2. 创建空文件: C:\Text.txt

 New-Item -Name text.txt

3. 尝试使用set-item 去修改text.txt 的内容为 TESTING,是否可执行? 或者是否有报错?

尝试运行: Set-Item -Path C:\text.txt -Value TESTING 我会发现报错, 如下图

可见该text.txt 项并不支持 set-item 项属性,所以会造成运行错误。

4. Get-ChildItem 的 -Filter 、-Include 和 -Exclude 参数之间有什么不同?

通过 help Get-Item -full 命令我们可以查看到 get-item 所有参数的详细解释。

-Filter:

-Include:

-Exclude:

猜你喜欢

转载自blog.csdn.net/weixin_42545594/article/details/81238943