草庐IT

invoke-item

全部标签

windows - 使用 powershell Invoke-AddCertToKeyVault 命令创建 Azure 自签名证书

最近,我尝试按照微软的手册为AzureServiceFactory创建自签名证书:AzureDocs:SecureaServiceFabriccluster,step2.5,02/05/2016但是命令Invoke-AddCertToKeyVault失败并出现下一个错误:Invoke-AddCertToKeyVault:Theterm'Invoke-AddCertToKeyVault'isnotrecognizedasthenameofacmdlet,function,scriptfile,oroperableprogram.Checkthespellingofthename,orif

windows - Copy-Item 用于使用凭据将文件从本地复制到远程服务器

我正在尝试将一些文件和文件夹从我的本地计算机复制到远程服务器:Copy-Item.\copy_test.txt-destination"\\serverip\c$\backups\"但是我收到一个错误:Copy-Item:Logonfailure:unknownusernameorbadpassword.Atline:1char:10+Copy-ItemIwastryingusingcredentialsbutthiscommanddoesnotallow-Credentialargument.Iwassearchingalotandineveryexamplethecommandis

windows - 文件夹上的 Powershell Remove-Item 仅在通过 Ansible 运行时失败

我有一个可以完全删除目录的powershell函数。我已经按照powershell的建议构建了它(其中有一些额外的跟踪)functionDeleteFolderAndContents(){param([Parameter(Mandatory=$true,Position=1)][string]$folder_path)Get-ChildItem-Path"$folder_path"-Recurse-Force|Remove-Item-Force-RecurseWrite-Host"Deletedallfilesindirectory.Willattempttodeletedirecto

windows - 如何在 Powershell 中使用 New-Item cmdlet 将 SSH 私钥写入文件?

这个问题在这里已经有了答案:PowerShell:StoreEntireTextFileContentsinVariable(5个答案)关闭5年前。我正在开发一个Powershell脚本,它从文件中读取sshkey和已知主机并将其写入另一个文件。我读了key$SshPrivateKey=Get-Content'ssh-keys\id_rsa'然后我写新文件New-Item-path$SshKeysDir-Name$SshPrivateKeyFile-Value$SshPrivateKey-ItemTypefile-force这适用于公钥。但由于某些奇怪的原因,它不适用于私钥。新文件以结

windows - 在文件名中使用通配符的 Invoke-WebRequest -OutFile <filename>

如何在Invoke-WebRequest的-OutFile参数中引用通配符?$filename="Image[1].jpg"$uri=[System.Uri]"http:/url/to/image.jpg"Invoke-WebRequest-Uri$uri-OutFile$filename这段代码给了我一个异常(exception):CannotperformoperationbecausethewildcardpathImage[1].jpgdidnotresolvetoafile.Technet说Twothingstonotehere.First,weenclosedthepath

windows - Powershell Invoke-WebRequest 一直很慢。我怎样才能解决这个问题?

我有一台全新的联想Yoga笔记本电脑,装有Windows10专业版。我注意到Chocolatey在下载和安装本应快速安装的软件时似乎真的非常慢。这让我怀疑Powershell存在问题,无论是PS本身还是这台笔记本电脑的某些方面,我都无法对其进行故障排除。简而言之,curl/Invoke-WebRequest始终需要大约43秒。PSC:\WINDOWS\system32>Measure-Command{curlhttps://microsoft.com}Days:0Hours:0Minutes:0Seconds:43Milliseconds:316Ticks:433164486Total

windows - wininet API 的 P/Invoke 机制

我正在使用wininetapi将HTTPPOST发送到SSL服务器。我想使用P/Invoke将这些api包装到C#,因为C#中的原始代码。我如何将这些api包装到c#。我试过了,但没有用。我正在为WindowsMobile和智能手机做这个。LPCTSTRlpszAgent=_T("CeHttp");DWORDdwError;DWORDsizeInResult,sizeOutResult,sizeToWrite,sizeWritten,dwRead;HINTERNEThInternet=NULL;HINTERNEThConnect=NULL;HINTERNEThRequest=NULL;

windows - Copy-Item 命令在 Powershell 命令行中有效,但在 bat 文件中无效

尝试使用Copy-Item命令将文件从一个文件夹复制到另一个文件夹。以下命令在powershell命令行中运行,但在*.bat文件中运行时抛出错误:Copy-ItemC:\script\*D:\它抛出以下错误:'Copy-Item'isnotrecognizedasaninternalorexternalcommand,operableprogramorbatchfile. 最佳答案 您不能直接批量运行PowerShellcmdlet,您必须调用powershell.exe并将命令传递给它:powershell-Command"Co

windows - 德尔福 7 : Enabling automatic list of possible options for items I am working on?

我最近开始使用Delphi7,目前正在学习使用它制作应用程序。我在阅读基础知识时读过这篇文章:它说Delphi帮助我们列出了我们正在处理的项目的可能选项。这些可能的选项对我有很大帮助,因为我目前不知道有哪些选项,但是,当我编写时,我没有看到可能的选项窗口,如下所示:默认情况下它是否被禁用,如果是,我在哪里可以启用它?值得一提的是,我正在使用Windows10,Windows10确实警告我Delphi可能无法在我的Windows上正常工作,尽管我真诚地怀疑这就是这背后的原因,因为整个程序运行良好。在此先感谢您,对于这样的菜鸟问题,我深表歉意:) 最佳答案

windows - Remove-Item 不删除文件

这是我的PowerShell脚本:$dir=([io.fileinfo]$MyInvocation.MyCommand.Definition).DirectoryNameGet-ChildItem-Path.\-Filter*.png-Recurse-File|Where-Object{$_.Name-match".+[\]]+.png"}|ForEach-Object{echo$_.FullName$(Test-Path$_.FullName)Remove-Item$_echo$_.FullName$(Test-Path$_.FullName)}回声给出了实际的文件名,但Test-P