当文件保存在文件夹中时,如何启动统计程序JMP?

发布于 2025-01-26 06:31:27 字数 829 浏览 2 评论 0原文

我想使用PowerShell中的代码来启动JMP分析。首先,我只想在文件夹中保存在文件夹中,然后我会调整此文件时启动相同的代码。因此,我使用此论坛上看到的内容来创建此代码:

### SET FOLDER TO WATCH
    $watcher = New-Object System.IO.FileSystemWatcher
    $watcher.Path = "C:\Users\GROUSD01\Desktop\test"
    $watcher.Filter = "*.xlsx"
    $watcher.EnableRaisingEvents = $true  

### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
    $action = { Start-Process jmp.exe "C:\Users\GROUSD01\Desktop\Création code MPPT\ScriptMPPT.jsl"
              }    
### DECIDE WHICH EVENTS SHOULD BE WATCHED 
    Register-ObjectEvent $watcher "Created" -Action $action 

当我在PowerShell中运行它时,它会检测新文件并尝试运行命令,但找不到文件.jsl和JMP打印错误。但是,当我在命令行中运行此代码时:

jmp.exe "C:\Users\GROUSD01\Desktop\Création code MPPT\ScriptMPPT.jsl"`

它找到了好文件并运行好东西。

您对为什么会有问题有任何想法吗?

I want to use a code in PowerShell to launch JMP analysis. To begin I just want to launch the same code any time a file is saved in the folder and after I will adapt this. So I use something I see on this forum to create this code:

### SET FOLDER TO WATCH
    $watcher = New-Object System.IO.FileSystemWatcher
    $watcher.Path = "C:\Users\GROUSD01\Desktop\test"
    $watcher.Filter = "*.xlsx"
    $watcher.EnableRaisingEvents = $true  

### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
    $action = { Start-Process jmp.exe "C:\Users\GROUSD01\Desktop\Création code MPPT\ScriptMPPT.jsl"
              }    
### DECIDE WHICH EVENTS SHOULD BE WATCHED 
    Register-ObjectEvent $watcher "Created" -Action $action 

When I run it in Powershell, it detects the new file and tries to run the command but doesn't find the file .jsl and JMP prints an error. But when I run this code in the command line:

jmp.exe "C:\Users\GROUSD01\Desktop\Création code MPPT\ScriptMPPT.jsl"`

It finds the good file and runs the good things.

Do you have any idea about why is there a problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文