在玩过 Ubuntu 10.04 之后,我注意到一件有趣的事情是你可以在 gedit 中嵌入一个终端。是否有类似的插件可以让我将 Powershell(或命令提示符)窗口嵌入到记事本 ++ 中?
PS cert:\currentuser\my> dir
Get-ChildItem : Access is denied.
At line:1 char:3
+ dir <<<<
Run Code Online (Sandbox Code Playgroud)
我无法访问我的任何代码签名证书来签署 PowerShell 脚本。我可以打开 MMC、证书,并看到我的代码签名证书已安装并在我的机器上有效(Windows XP SP 3)。
另一个奇怪的事情是我无法从 PowerShell 访问我的任何映射网络驱动器,但我可以在 Windows 资源管理器和 DOS 窗口中看到它们。
我已经卸载了 PowerShell,重新启动并重新安装了 PowerShell 1,但仍然有同样的问题。
编辑:我在这台机器上的日常帐户不是管理员,但我确实有一个管理员帐户,可以用于需要它的任务。代码签名证书分配给我的日常帐户,我应该不必成为管理员来签署代码。我不确定如何将此帐户权限授予证书存储区。
编辑 2: 我运行FileMon和RegMon来查看我被拒绝访问的内容。 cert:CurrentUser\My是文件夹C:\Documents and Settings\USERNAME\Application Data\Microsoft\SystemCertificates\My\Certificates。它还拒绝我访问C:\Documents and Settings\USERNAME\Local Settings\Temp. 我可以打开资源管理器并毫无问题地访问这些文件夹中的文件。我暂时授予Everyone了这些文件夹的完全权限,但仍然收到来自 PowerShell 的拒绝访问消息。
谷歌没有透露太多。我该怎么办?
来自 Windows PowerShell 事件日志的消息:
Provider Health: Attempting to perform the GetChildItems operation on
the 'Certificate' provider failed for path '\currentuser\my'. Access …Run Code Online (Sandbox Code Playgroud) 默认情况下,当您help在 PowerShell 中使用时,输出使用more. 如果您安装 PSCX,它会为您提供使用的选项less。默认情况下,我宁愿两者都不使用(我的控制台窗口上有足够大的回滚缓冲区)。Get-Help不分页输出
如何help在 PowerShell 中关闭分页?无需输入更多内容?
可能是一个完全的菜鸟问题,但是:
当我跑
Start-Process ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -RedirectStandardOutput ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log" -RedirectStandardError ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log" -WindowStyle Hidden
Run Code Online (Sandbox Code Playgroud)
我收到错误
Start-Process : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:14
+ Start-Process <<<< ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -RedirectStandardOutput ".\packages\
PS-Get.0.1.0.0\NuGet.exe.Update.log" -RedirectStandardError ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log" -WindowStyle Hidden
+ CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.StartProcessCommand
Run Code Online (Sandbox Code Playgroud)
但所有的:
Start-Process ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -RedirectStandardOutput ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log"
Start-Process ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -RedirectStandardError ".\packages\PS-Get.0.1.0.0\NuGet.exe.Update.log"
Start-Process ".\packages\PS-Get.0.1.0.0\NuGet.exe" update -WindowStyle Hidden
Run Code Online (Sandbox Code Playgroud)
工作正常......我错过了什么?
我在共享位置有一个文件,我想将其复制到本地硬盘驱动器。但是,我不会以有权访问共享的用户身份运行。所以我希望能够在不同的登录名(有权限的登录名)下进行身份验证并复制文件。
我能做些什么来实现这一目标吗?
我试过这个命令(在 ps1 文件中):
runas /user:domain\username "copy-file $shareloc $destloc"
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
RUNAS ERROR: Unable to run - copy-file \\share\some\dir\file.exe C:\dir\file.exe
2: The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)
如何使用具有 powershell 或批处理文件的不同登录名复制网络共享上的文件?
我需要执行类似
7za e $file_path -oC:\Destination
在 powershell 脚本中,但用变量替换目标文件夹 (C:\Destination)。有些人喜欢:
7za e $file_path -o$output_path
这显然不起作用。前面的语句实际上创建了一个具有实际名称的文件夹$output_path
如何才能做到这一点?
我创建了一个符号链接,如下所示:
PS C:\dev\bin> cmd /c mklink "wd" c:\dev\code
symbolic link created for wd <<===>> c:\dev\code
Run Code Online (Sandbox Code Playgroud)
好,简单。然后我尝试 cd 到它:
PS C:\dev\bin> cd wd
Set-Location : Cannot find path 'wd' because it does not exist.
PS C:\dev\bin> cd .\wd
Set-Location : Cannot find path '.\wd' because it does not exist.
PS C:\dev\bin> cd \wd
Set-Location : Cannot find path 'C:\wd' because it does not exist.
Run Code Online (Sandbox Code Playgroud)
在 Linux 中执行此操作要容易得多。我如何实际 cd 到 PowerShell 中的符号链接?
(这似乎是一个简单的问题,但 google 结果的前 3 页没有答案。)
我跑Set-ExecutionPolicy至AllSigned,当我尝试运行我的脚本,在提示信任发布者,我不小心进入了V,永远不要运行该脚本。
如何撤消此操作,以便可以在不更改执行策略的情况下再次运行脚本?
我试图将一些文件从共享网络驱动器复制到我的桌面,但xcopy /C迟早会出现错误The handle is invalid。也许有另一种方法来复制文件,这样我就不会遇到那个问题?我可以使用的唯一工具是那些已经内置到 Windows 7 中的工具(即 powershell 和 cmd)。也没有ftp。
我想知道我的路径变量的内容是什么,所以我运行了这个命令:
D:\> Get-ChildItem env:path
Name Value
---- -----
Path %SystemRoot%\system32\WindowsPowerShell\v1.0\;D:\java\jdk\javaFX2.0\bin;C:\Program Files (x86)\PuTTY;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files (x86)\PHP\;C:\oraclexe\app\oracle\product\10.2.0\serve...
Run Code Online (Sandbox Code Playgroud)
问题是结果是毫无用处的。
我如何才能拥有纯文本且没有省略号?
powershell ×10
7-zip ×1
batch-file ×1
certificate ×1
code-signing ×1
command-line ×1
embedded ×1
notepad++ ×1
parameters ×1
plugins ×1
windows ×1
windows-7 ×1