te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - tsc : File C:Program Filesnodejstsc.ps1 cannot be loaded because running scripts is disabled on this system - Stack
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - tsc : File C:Program Filesnodejstsc.ps1 cannot be loaded because running scripts is disabled on this system - Stack

programmeradmin3浏览0评论

I am trying to run a mand tsc for a file.ts as to pile this code to js but I fins the below error:

tsc : File C:\Program Files\nodejs\tsc.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at 
https:/go.microsoft/fwlink/?LinkID=135170.
At line:1 char:1
+ tsc test.ts
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

and here's a screen shot of my Editor:

any one knows how can I solve this error?

I am trying to run a mand tsc for a file.ts as to pile this code to js but I fins the below error:

tsc : File C:\Program Files\nodejs\tsc.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at 
https:/go.microsoft./fwlink/?LinkID=135170.
At line:1 char:1
+ tsc test.ts
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

and here's a screen shot of my Editor:

any one knows how can I solve this error?

Share Improve this question asked Jun 25, 2020 at 9:48 Mahmoud Al-HaroonMahmoud Al-Haroon 2,4498 gold badges46 silver badges83 bronze badges 2
  • 1 Have a look at learn.microsoft./en-us/powershell/module/… – Umair Khan Commented Jun 25, 2020 at 9:51
  • @UmairKhan thanks for your ment I hope you can let me know the direct answer or small explanation bout this – Mahmoud Al-Haroon Commented Jun 25, 2020 at 9:58
Add a ment  | 

2 Answers 2

Reset to default 13

PowerShell has some Execution Policies which tell PS what to do if user tries to execute some code or script.

If the execution policy is Undefined, which is mostly the case, the applied policy is Restricted.

As defined in Restricted Policy, all script files execution is prevented.

Prevents running of all script files, including formatting and configuration files (.ps1xml), module script files (.psm1), and PowerShell profiles (.ps1).

You can check your current execution policy by running this mand in PS as advised here.

Get-ExecutionPolicy

OR

Get-ExecutionPolicy -List

You can change execution policy like

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

Keep in mind

In Windows Vista and later versions of Windows, to run mands that change the execution policy for the local puter, LocalMachine scope, start PowerShell with the Run as administrator option.

Hope this helps.

To solve this problem;

Runs Powershell as administrator.

Later could you try this:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

Then run the script

Type Y.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论