指定“开始"Windows 中 schtasks 命令中的目录 [英] Specifying "start-in" directory in schtasks command in windows

查看:40
本文介绍了指定“开始"Windows 中 schtasks 命令中的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意识到这个问题在以下线程中得到了回答":使用 schtasks.exe 指定计划任务的运行目录

I realize that this question is "answered" at the following thread: Specifying the running directory for Scheduled Tasks using schtasks.exe

但是,我仍然无法理解答案,也无法准确了解在我的情况下结果会是什么样子.

However, I'm still having trouble understanding the answer and seeing exactly what the result would look like for my situation.

我的 schtasks 命令如下所示:

My schtasks command looks like this:

Schtasks/Create/TR "C:\Program Files\Java\jre6\bin\javaw.exe main.MoveFile input.txt"/SC WEEKLY/TN mytask

我想在C:\My Library"的目录中指定开始.在tr部分前加一个\",就填入了C:\Program Files\Java\jre6\bin"的起始目录.

I want to specify the start in directory of "C:\My Library". Putting a "\" before the tr section fills in a start-in directory of "C:\Program Files\Java\jre6\bin".

我已经把它搞得一团糟,但我似乎无法让它发挥作用.

I've messed around with it a lot, but I just can't seem to make it work.

推荐答案

如果所有其他方法都失败了,您可以重定向到一个批处理文件,设置它自己的 CD,然后调用您的程序.
例如:

If all else fails, you can redirect to a batch file that sets it's own CD, then calls your program.
for example:

Schtasks /Create /TR "C:\example\batch.bat" /SC WEEKLY /TN mytask

作为 schtask 和

As the schtask, and

cd "%temp%\"
"C:\Program Files\Java\jre6\bin\javaw.exe main.MoveFile input.txt"

为C:\example\batch.bat".这应该将当前目录保留为您在批处理文件中将其更改为的任何内容,并保留与该目录相关的所有引用.

as "C:\example\batch.bat". That should keep the current directory as whatever you change it to in the batch file and keep all references relative to that.

这篇关于指定“开始"Windows 中 schtasks 命令中的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆