在 XP 中,我习惯于在文件夹的上下文菜单中使用“在此处打开命令窗口”选项。在 Vista 中,默认情况下它是隐藏的,但我知道我可以在右键单击时按住 shift 以查看该选项。
我想知道的是,除了 PowerShell 而不是 cmd.exe,我怎样才能获得相同的功能?
更好的是让它始终在那里,而不必移动+右键单击。
在 Windows 7 中,如何设置默认的 PowerShell 窗口大小?默认情况下,它对于我正在使用的上网本屏幕来说太高了。
我已经尝试了更改大小的常用方法——通过单击左上角并选择“属性”——但它告诉我:(Unable to modify the shortcut: . Check to make sure it has not been deleted or renamed.是的,错误消息中间有一个点)
我还尝试右键单击“开始”菜单中的 PowerShell 快捷方式并更改那里的属性,但是,这些更改似乎没有生效。
我听说了一些有关 PowerShell 功能的信息。其中一些似乎是 Unix shell 的典型特性。
因此,Powershell 似乎包括管道和命令行开关,类似于 shell 脚本。但我还没有尝试过(没有 Windows),所以我可能是错的。
所以我的问题是:Powershell 是类似于 Unix shell 还是概念不同?
如果是后者:概念在哪些方面有所不同?
我有我想要替换字符串.txt文件aaa用bbb。
我尝试了以下 PowerShell 代码:
Get-Content c:\1.txt | ForEach-Object { $_ -replace "aaa", "bbb" } | Set-Content c:\1.txt
Run Code Online (Sandbox Code Playgroud)
我收到1.txt另一个进程正在使用的错误。我究竟做错了什么?
在编写 PowerShell 脚本时,我注意到当某些 cmdlet 遇到问题时,它们会显示交互式提示,例如非空目录上的 Remove-Item。这在尝试自动化任务时是致命的,我更希望操作失败并抛出异常或返回错误的返回代码,以便整个脚本不会被锁定等待响应。
有没有办法强制 PowerShell 自动失败,而不是寻求用户对操作的输入?
我从 Windows 防火墙得到了这个弹出窗口。路径中的“C:2\”是什么?真正的路径是D:\Steam\SteamApps\common\...

我cd /d C:2\在 cmd 中尝试并得到"The system cannot find the path specified."
我也在cd C:2\Powershell 中尝试过并得到了"Set-Location : Cannot find path 'C:\2\' because it does not exist."
那么“C:2\”如何成为“D:\”的快捷方式?
更新:
C:2正如@Tyson 建议的那样,我尝试在注册表中搜索。当我C:2在注册表中搜索时没有选中“仅匹配整个字符串”并且没有选中“仅匹配整个字符串”的结果时,有很多不相关的搜索结果。然而我找到了钥匙,它在里面HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules,它的价值是v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=17|Profile=Private|App=C:2\steam\steamapps\common\sonic & all-stars racing transformed\asn_app_pcdx9_final.exe|Name=asn_app_pcdx9_final.exe|Desc=asn_app_pcdx9_final.exe|Defer=User|. 有一个规则D:\Steam\SteamApps\common\Sonic & All-Stars Racing Transformed\ASN_App_PcDx9_Final.exein Windows Firewall with Advanced Security > Inbound Rules。我还找到了军团要塞 2 的规则,它v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Private|App=C:0\steam\steamapps\common\team fortress 2\hl2.exe|Name=hl2.exe|Desc=hl2.exe|Defer=User|在注册表和D:\Steam\SteamApps\common\Team Fortress 2\hl2.exeWindows 防火墙规则列表中。安装的其他游戏在注册表和 Windows 防火墙规则中D:\Steam\...都有 …
我的键盘没有Num Lock键,并且出于某种原因没有任何注册表编辑工作。
我可以在 Windows 10 上使用命令提示符或 PowerShell 来“按下”一个键吗?我正在寻找类似在命令提示符或 PowerShell 中press pgup按下Page Up键的方法,但对于Num Lock.
在 Powershell 或 CMD 中的 git 存储库中时,发出
git mv * whatever
将返回
致命的:错误的来源,来源=*,目的地=任何东西
这在使用 MSYS (Git Bash) 时工作正常。
我在 Windows 10(版本 1703 - Creators Update)上遇到 powershell 提示启动缓慢的问题。
我的硬件规格(相当快的机器):英特尔 i5-7440HQ(四核)/32GB DDR4 RAM/512 三星 SSD 硬盘。
我试图绕过配置文件和执行策略,但它没有改变任何东西:
powershell -noprofile -ExecutionPolicy Bypass ( Measure-Command { powershell "Write-Host 1" } ).TotalSeconds
6,228067
我的朋友在没有 Creators Update 的情况下使用 Windows 10 的同一台笔记本电脑在不到 0.5 秒的时间内运行了 powershell。
还尝试使用 ngen.exe 进行一些编译,但没有帮助:
$env:path = [Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()
[AppDomain]::CurrentDomain.GetAssemblies() | % {
if (! $_.location) {continue}
$Name = Split-Path $_.location -leaf
Write-Host -ForegroundColor Yellow "NGENing : $Name"
ngen install $_.location | % {"`t$_"}
}
Run Code Online (Sandbox Code Playgroud)
知道我该如何调查这个问题吗?
你好
我正在尝试使用Resize-VHDcmdlet,但这会导致以下错误:
PS> Resize-VHD -Path "C:\Container.vhd" -SizeBytes 20GB
Error:
Resize-VHD : The term 'Resize-VHD' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Resize-VHD -Path "C:\Container.vhd" -SizeBytes 20GB
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Resize-VHD:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
powershell ×10
command-line ×3
windows ×3
cmd.exe ×2
context-menu ×1
git ×1
msys ×1
numlock ×1
path ×1
performance ×1
shell ×1
steam ×1
unix ×1
vhd ×1
windows-10 ×1
windows-7 ×1