小编Val*_* DG的帖子

即使具有管理员权限,批处理脚本访问也被拒绝

我在Windows7中有一个批处理脚本来更新hosts失败的文件。我以具有管理权限的用户身份登录。

即使我使用“以管理员身份运行”选项运行脚本,Access denied. 0 files copied在执行这部分脚本时也会得到:

for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "IPv4"') do set ip=%%b
set ip=%ip:~1%

REM create changing part of hosts file...   
if exist %temp%\temp.txt del %temp%\temp.txt
echo %ip% myproxy >> %temp%\temp.txt  

REM check this...
set hostpath=C:\WINDOWS\system32\drivers\etc

REM add static part of hosts file
type "%hostpath%\hosts-static" >> %temp%\temp.txt

REM replace hosts file
copy /y %temp%\temp.txt "%hostpath%\hosts"

ipconfig /flushdns
netsh interface IP delete arpcache
pause
Run Code Online (Sandbox Code Playgroud)

我还尝试创建快捷方式并设置“高级 -> 以管理员身份运行”选项,但没有成功。

如果我以管理员身份打开 cmd shell,然后从那里运行脚本,一切正常,但无法直接双击文件(或其链接)来运行它。任何想法?


编辑:

  • 添加了整个脚本。 …

windows batch-file windows-7-x64

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

Material2 cdk Scrollable从未初始化

我正在尝试使用新的API来监听Material2中的滚动事件.我在app.module.ts中导入了ScrollDispatchModule,并使用cdkScrollable指令注释了一个容器,如

<div cdkScrollable>
   <div class="my-content">
   ...
   </div>
   <footer class="my-footer">
   ...
   </footer>
</div>
Run Code Online (Sandbox Code Playgroud)

我想在ViewChild的组件中访问它并订阅这样的事件,但可滚动变量总是未定义的:

  @ViewChild(Scrollable) scrollable: Scrollable; 

  ngAfterViewInit() {
     this.scrollable.elementScrolled().subscribe(scrolled => {
         //do stuff
     });
  }
Run Code Online (Sandbox Code Playgroud)

我是否以正确的方式使用这些API?

angular-material2 angular angular-cdk

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