批处理脚本 - 需要指定使用 ANSI 控制台并执行命令
这是一个最好的菜鸟问题,但谷歌没有找到我需要的东西。
我有一个 ruby 脚本,需要通过任务计划程序启动。我认为我使用以下方法做得正确:
cmd /k ruby test.rb
这在从文件夹启动 .bat 文件时有效。但是,如果它从 taskeng.exe 运行,则会失败,因为它在我的 system32 文件夹中查找。我不希望它从 system32 运行,所以我如何格式化它以从 c:/dev/ 运行
再次,对于这个极其菜鸟的问题感到抱歉。
This is a noob question at its best but Google isn't finding what I need.
I have a ruby script that I need to fire off via task scheduler. I thought I did it right by using the following:
cmd /k ruby test.rb
This works when starting the .bat file from the folder. However, if it runs from taskeng.exe it fails because its looking in my system32 folder. I don't want it to run from system32 so how do i format this to run from say, c:/dev/
Again, sorry for the extremely noob question.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以省略
cmd
,只使用or more (就您的情况而言):
或类似的东西。提供脚本的完整路径通常有助于找到它;-)
在任何情况下,如果您需要工作目录,您可以在计划任务本身中设置它。类似于以下内容:
同样,如果您确实需要其中的
cmd
。只需填写开始于字段,您就拥有了一个工作目录。You can leave out
cmd
of that and just useor rather (in your case):
or something like that. Giving the complete path to the script usually helps in finding it ;-)
In any case, if you need the working directory you can set it in the scheduled task itself. Something akin to the following:
Likewise, if you actually need
cmd
in there. Just fill out the Start in field and you have a working directory.