小编Kei*_*ith的帖子

如何设置Visual Studio代码默认克隆目录

如何在Visual Studio Code中设置默认克隆目录?在我选择Git:Clone之后,我粘贴了存储库URL,然后我被要求提供父目录.如何将父目录设置为其他默认目录?

visual-studio-code vscode-settings

7
推荐指数
1
解决办法
975
查看次数

Pester 没有捕捉到抛出的错误

当我运行以下纠缠测试时,我希望它能够捕获预期的错误,但它没有。但是,当我使用不同的 throw 语句使用不同的函数运行测试时,它会起作用。

纠缠测试:

Describe "Remove-GenericCredential Function Tests" {
  $InternetOrNetworkAddress = 'https://PesterTestUser@PesterTestURl.com'

  Context "Test:  Remove-GenericCredential -InternetOrNetworkAddress '$InternetOrNetworkAddress' (Credential does not exist)" {
  It "This Command threw an error.  The credential does not exist." { { (Remove-GenericCredential -InternetOrNetworkAddress $InternetOrNetworkAddress -Confirm:$false) } | should throw "Remove-GenericCredential : Credential $InternetOrNetworkAddress not found" }
  }
}
Run Code Online (Sandbox Code Playgroud)

未捕获的错误:

Remove-GenericCredential : Credential https://PesterTestUser@PesterTestURl.com not found

At C:\Users\klocke7\Documents\WindowsPowerShell\Modules\Ford_CredentialManager\Tests\Remove-GenericCredential.Tests.ps1:30 char:76
+ ... xist." { { (Remove-GenericCredential -InternetOrNetworkAddress $Inter ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException …
Run Code Online (Sandbox Code Playgroud)

powershell pester

6
推荐指数
1
解决办法
2888
查看次数

用于在网络适配器上打开“Microsoft 网络的文件和打印共享”的 PowerShell 命令

是否有 PowerShell 命令/代码可以在网络适配器上打开“Microsoft 网络的文件和打印共享”?

我发现以下链接如何在 Windows 10 中打开或关闭文件和打印机共享,其中显示了在防火墙(选项 3)但不在网卡(选项 4)打开“文件和打印共享”的 powershell 代码。

我发现我可以使用drfpshare.exe带有参数的文件/on来打开它。如果可能的话,我的偏好是使用直接的 PowerShell 代码,但如果我必须使用二进制文件,我可以让它工作。

最后需要注意的是,命令/代码需要与 PowerShell 2 及更高版本一起使用。

powershell network-programming

3
推荐指数
1
解决办法
7816
查看次数