相关疑难解决方法(0)

Windows 7上的PowerShell:常规用户的Set-ExecutionPolicy

我想以普通用户身份在Windows 7上运行PowerShell脚本.每当我尝试时,我都会收到以下错误:

File C:\Users\danv\Documents\WindowsPowerShell\profile.ps1 cannot be loaded because the
execution of scripts is disabled on this system. Please see "get-help about_signing" for
more details.
At line:1 char:2
+ . <<<<  'C:\Users\danv\Documents\WindowsPowerShell\profile.ps1'
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException
Run Code Online (Sandbox Code Playgroud)

尝试解决via Set-ExecutionPolicy Unrestricted失败:

PS C:\Users\danv> Set-ExecutionPolicy Unrestricted
Set-ExecutionPolicy : Access to the registry key
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell'
is denied.
At line:1 char:20
+ Set-ExecutionPolicy <<<<  Unrestricted
    + CategoryInfo          : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
Run Code Online (Sandbox Code Playgroud)

我可以Set-ExecutionPolicy …

powershell windows-7

61
推荐指数
3
解决办法
11万
查看次数

如何修复“此系统上禁用运行脚本”?

当我尝试在 VS Code 终端上运行 ionic 命令时ionic serve,出现以下错误。

我怎样才能解决这个问题?

ionic : File C:\Users\Lakshan\AppData\Roaming\npm\ionic.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see 
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ ~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
Run Code Online (Sandbox Code Playgroud)

powershell

57
推荐指数
4
解决办法
22万
查看次数

如何修复错误 - nodemon.ps1 无法加载,因为在此系统上禁用了运行脚本,(没有安全风险)?

终端错误:无法加载 nodemon.ps1,因为在此系统上禁用了运行脚本。有关详细信息,请参阅 https://go.microsoft.com/fwlink/?LinkID=135170 上的 about_Execution_Policies。

我有一个通过这种方式解决问题的解决方案

  1. 以管理员身份打开 Windows PowerShell
  2. 运行此命令:Set-ExecutionPolicy Unrestricted

这解决了问题,但这样系统会显示安全风险警告。我的问题:有没有其他方法可以在没有安全风险的情况下解决这个问题?目标是使用 nodemon。

powershell web-development-server node.js nodemon visual-studio-code

46
推荐指数
9
解决办法
6万
查看次数

在VS2015的Developer命令提示符中找不到dnx命令

刚刚安装了Visual Studio 2015 RC,当我打开Developer command prompt for VS2015并输入dnx它时说:

'dnx'不被识别为内部或外部命令,可操作程序或批处理文件.

经过两天的思考,我发现如果我输入dnvm use default它会添加一个环境变量的路径,以便dnx找到该命令.只有当前窗口打开时,此操作才会持续存在.

为什么默认的.net 5框架不会自动添加到PATH环境变量中?

visual-studio-2015 asp.net-core

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

无法加载 tsc.ps1,因为在此系统上禁用了运行脚本

在 PowerShell 上,我在执行tsc. 这是以前从未发生过的。

我不确定我是否应该使用 PowerShell 安全设置来纠正这个问题,例如基于这个:PowerShell 说“在这个系统上禁用了脚本的执行”。

更新

这是 npm 使用 ps1 脚本的新预期功能。他们的 repo 中提出了一个问题:https : //github.com/npm/cli/issues/470

powershell typescript

38
推荐指数
7
解决办法
4万
查看次数

Windows计划任务成功但返回结果0x1

我在Windows 2008 R2服务器上有一个计划任务.该任务包括Start In目录条目.该任务运行,它运行的批处理文件执行它应该执行的操作.当我从命令提示符运行批处理文件时,我看不到任何错误.问题是"上次运行结果"是0x1(函数调用不正确).

我确实一次得到这个与不正确的DOS语句IF EXISTS file.txt DO (Copy file.txt file1.txt),通过删除DO语句纠正.当前批处理文件不会显示任何错误或警告.

我为什么得到一个0x1结果?

运行的批处理文件:

PUSHD \\JUKEBOX4\Archives\CallRecording
REM only move csv and wma together.  wma should be created last.
IF NOT EXIST C:\CallRecording (MKDIR C:\CallRecording)
FOR /f %%f IN ('DIR /b *.wma') DO (
    IF EXIST %%~nf.csv (MOVE /Y %%~nf.* C:\CallRecording\)
)
POPD
CD /D "C:\Program Files (x86)\Olim, LLC\Collybus DR Upload"
CollybusUpload.exe
POPD
Run Code Online (Sandbox Code Playgroud)

有关预定任务设置的信息:

  • 要运行的程序: C:\Program Files (x86)\Olim, LLC\Collybus DR Upload\CallRecordingUploadFromH.cmd
  • 开始于: C:\Program Files …

scheduled-tasks

27
推荐指数
4
解决办法
20万
查看次数

用于重置网络适配器的Command/Powershell脚本

OS:Vista企业

当我在家庭和办公室网络之间切换时,我总是遇到连接到网络的问题.几乎总是我必须在"网络和共享中心"中使用诊断服务,当我使用重置网络适配器选项时问题就解决了.

这需要花费很多时间(3-4分钟),所以我试图找到一个命令或一个PowerShell脚本/ cmdlet,我可以直接使用它来重置网络适配器,每次我必须切换时保存这5分钟网络之间.有什么指针吗?

powershell networking windows-vista

25
推荐指数
6
解决办法
7万
查看次数

电子 - node.js - ng : 无法加载文件路径\ng.ps1,因为在此系统上禁用了运行脚本

我正在尝试在Windows 10in上编译一个项目Visual Studio Code,我的设置如下:

1)npm版本6.12

2)Node.js版本12.13

3) Angular CLI: 8.3.19

我的问题是,当我尝试运行ng serve我收到以下输入:ng : File C:\Users\name\AppData\Roaming\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system。其次是For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

到目前为止我尝试过的

1)我访问了网站,发现Set-ExecutionPolicy -ExecutionPolicy RemoteSigned应该是我必须在shell中输入的命令。因此,我所做的是:

PS C:\Users\raggi\OneDrive\Desktop\pitalkdashboard> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

但这导致了以下错误:

Set-ExecutionPolicy : Access to the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell is denied. To change the execution policy for the default (LocalMachine) scope, …

powershell node.js electron npm-start angular

22
推荐指数
5
解决办法
6万
查看次数

VS代码终端:无法加载Activate.ps1,因为在此系统上禁用运行脚本

我在 python 中创建了一个虚拟环境,现在在 vscode 中从命令行激活相同的虚拟环境时出现错误

PS C:\Users\hpoddar\Desktop\WebDev\ReactComplete\DjangoReact\ArticlesApp\APIProject> ..\venv\scripts\activate    
..\venv\scripts\activate : File C:\Users\hpoddar\Desktop\WebDev\ReactComplete\DjangoReact\ArticlesApp\venv\scripts\Activate.ps1 cannot be loaded because running 
scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ ..\venv\scripts\activate
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
Run Code Online (Sandbox Code Playgroud)

这是我的项目结构

在此输入图像描述

但是,如果我从命令行激活相同的功能,它就可以正常工作,不会出现任何错误。

Python版本:3.9.2

在此输入图像描述

python command-prompt virtualenv unauthorizedaccessexcepti visual-studio-code

22
推荐指数
1
解决办法
5万
查看次数

Javascript模块无法在浏览器中运行?

好吧,我看过这个网站并找到了几个不同的答案,其中没有一个对我有用.基本上有一个js文件,其中包含许多函数以及应用程序的主要代码.我想将我的所有函数移动到另一个js文件,以便我可以稍微清理一下我的代码.我对js相当新,但我知道在python中它就像从(路径)说"import(module)as(nickname)"一样简单

不管怎样,让我说我的functions.js模块中有一个名为show message的函数.

export function show_message(){
    alert("Hello");
}
Run Code Online (Sandbox Code Playgroud)

然后我在我的main.js文件的顶部

import { show_message } from './functions.js'
//I have also tried to import like this:
import * as func from './functions.js'

//And then I call it
show_message();
//I have also tried
func.show_message();
Run Code Online (Sandbox Code Playgroud)

我知道这很简单,但正如我在任何地方所说的那样,我看到了不同的答案,其中没有一个适合我.我正在使用Firefox btw.我也在控制台中收到错误,说我的导入声明需要在我的模块的顶部,我通过在HTML链接中指定类型来修复它(脚本src ="/ static/main.js"type ="模块")错误消失但现在说"同源策略不允许在文件(路径)读取远程资源(原因:cors请求不是HTTP)."

另一个错误是"本文档中不允许使用模块源URI".

这让我觉得我的导入语法可能正确,错误在我的HTML代码中?

任何帮助表示赞赏.

javascript module

13
推荐指数
5
解决办法
3349
查看次数