当文件保存在文件夹中时,如何启动统计程序JMP?
我想使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论