且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

FileSystemWatcher可在PowerShell ISE中运行,但无法在运行时运行

更新时间:2023-02-03 20:58:07

问题是您的函数ProcessFile未在Powershell会话中加载.

The problem is that your function ProcessFile isn't loaded in powershell session.

尝试以这种方式加载脚本:

Try loading you script in this way:

. .\myscript.ps1

通过这种方式,您在我的系统中的代码可以正常工作!

In this way your code in my system works!

了解有关 Dot Sourcing Powershell中的脚本.

Read about Dot Sourcing a script in powershell.