我想将Task Scheduler中的“配置为”设置为“ Windows 7”。
当前的C#代码:
using (TaskService ts = new TaskService())
{
TaskDefinition td = ts.NewTask();
TimeTrigger trigger = new TimeTrigger();
var startTime = TimeSpan.Parse(section1["ScheduledTime"]);
trigger.StartBoundary = DateTime.Today + startTime;
trigger.Repetition.Interval = TimeSpan.FromDays(1);
td.Triggers.Add(trigger);
td.Actions.Add(new ExecAction(@"Data.exe", argument, null));
var foldername = ts.GetFolder(@"\Bigdata");
Console.WriteLine(foldername.Path);
foldername.RegisterTaskDefinition(section1["JobName"], td, TaskCreation.CreateOrUpdate, "service@geotab.local", "traincloudCubel!ne");
}
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激 !!
我有一个非常简单的Power Shell脚本,该脚本会将控制台应用程序注册为每日计划的任务。
$TaskCommand = Read-Host 'Enter the path to the console application'
$TaskName = "TaskName"
$TaskStartTime = "10PM"
$TaskArg = "-WindowStyle Hidden -NonInteractive -Executionpolicy unrestricted"
$TaskAction = New-ScheduledTaskAction -Execute "$TaskCommand" -Argument "$TaskArg"
$TaskTrigger = New-ScheduledTaskTrigger -At $TaskStartTime -Daily
Register-ScheduledTask -Action $TaskAction -Trigger $TaskTrigger -TaskName "$TaskName" -User %computername%\theusername -Password "password" -RunLevel Highest
Run Code Online (Sandbox Code Playgroud)
应用程序从用户输入中读取文件路径,并尝试使用特定的用户帐户将应用程序注册为任务。我可以通过使用使脚本工作
-User "System"
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用上述脚本时,出现此错误:
Register-ScheduledTask:帐户名和安全ID之间未完成映射。
我已确保该帐户存在,因为该帐户当前正在运行多个服务。我也是Powershell的新手,因此尝试在用户名周围添加引号,但没有运气。
任何帮助深表感谢
我正在使用Spring TaskScheduler在应用程序启动时安排任务(显然是……)。
TaskScheduler在我的SpringConfig中创建:
@Configuration
@EnableTransactionManagement
public class SpringConfig {
@Bean
public TaskScheduler taskScheduler() {
return new ThreadPoolTaskScheduler();
}
}
Run Code Online (Sandbox Code Playgroud)
spring boot应用程序在我的Main.class中启动,并安排任务@PostConstruct
@SpringBootApplication
@ComponentScan("...")
@EntityScan("...")
@EnableJpaRepositories("... .repositories")
@EnableAutoConfiguration
@PropertySources(value = {@PropertySource("classpath:application.properties")})
public class Main {
private final static Logger LOGGER = LoggerFactory.getLogger(Main.class);
private static SpringApplication application = new SpringApplication(Main.class);
private TaskScheduler taskScheduler;
private AnalysisCleaningThread cleaningThread;
@Inject
public void setCleaningThread(AnalysisCleaningThread cleaningThread) {
this.cleaningThread = cleaningThread;
}
@Inject
public void setTaskScheduler(TaskScheduler taskScheduler) {
this.taskScheduler = taskScheduler;
}
public static void main(String[] args)
throws …Run Code Online (Sandbox Code Playgroud) 我有一个触发器的任务:
At 0:00 every day - after triggered, repeat every 1 hours for a duration of 1 day.
Run Code Online (Sandbox Code Playgroud)
在我的应用程序中,我以这种方式阅读时间:
dateTimeUtcNow = DateTime.Now;
Run Code Online (Sandbox Code Playgroud)
有时候,很少有人将dateTimeUtcNow显示为整整一小时之前几毫秒的时间 2015-11-11 14:59:59,914
服务器在Windows Server 2012 R2上运行,我可以在家庭版本上接受这个,但不能生产.
为什么?这是一个错误吗?我怎么能阻止这个?
我有一个Access VBA宏,它生成一个报告,将其保存在.pdf中,然后使用CDO通过电子邮件发送.如果我手动运行它或者如果我将它设置为在任务计划程序上运行安全选项"仅在用户登录时运行",则一切正常.但是,如果我将选项设置为"运行用户是否登录"(即使使用"以最高权限运行"选项),程序在第二行崩溃:
strFileFullPath = CurrentProject.Path & "\Test Report.pdf"
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFileFullPath
有错误
Microsoft Access无法将输出数据保存到您选择的文件.
我很确定这是因为宏在后台与其他用户一起运行.我一直在寻找一个解决方案,但我发现它是不可能的,我应该改变其他打印方法,例如PDF Creator(这带来了很多其他问题).
我在Windows Server 2012 R2 Standard中使用Access 2016.
我正在运行Windows 10。
我正在尝试使用任务计划程序运行备份作业(C:\ WINDOWS \ system32 \ robocopy.exe)。但是我遇到了问题。为了弄清楚发生了什么事情,我打开了历史记录。不幸的是,因为这样做,我每次点击历史记录标签,我得到以下错误:
对话框标题: “查询错误”
对话消息: “一个或多个日志查询有错误。”
该对话框中的表: “微软Windows的任务调度器/运营|指定的查询无效”
“显示的事件是部分结果。”
没有出现在历史窗格,所以我不能调试任何问题。有人知道发生了什么吗?
我有与中完全相同的错误
https://www.experts-exchange.com/questions/27676176/Query-Error-In-Microsoft-Task-Scheduler.html
答案在
答案站点(www.minasi.com)显然已经移动并且没有保留答案,因此无法尝试解决他的问题的解决方案。
我正在尝试使用 Windows 任务计划程序在 python 中运行脚本并编写一个 csv 文件。我一直在使用Anaconda,所以我不明白Python的命令行是如何工作的。如果我在 Spyder 上运行它,
import pandas as pd
import datetime
now_is = pd.DataFrame(['Now is '+ str(datetime.datetime.now())])
now_is.to_csv('C:/Users/camila/now_is.csv')
Run Code Online (Sandbox Code Playgroud)
它完美地工作。但是任务计划程序使用命令终端执行此 .py,此代码不起作用。
我想我需要再次安装 Pandas,但我什至无法让 pip 来处理这个......
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> pip.__version__
'9.0.1'
>>> pip install pandas
File "<stdin>", line 1
pip install pandas
^
SyntaxError: invalid syntax
>>>
Run Code Online (Sandbox Code Playgroud)
我安装的应用程序在运行时创建了一个 Task Scheduler 任务。此任务计划程序任务在 Windows 登录时运行我已安装的应用程序之一。所以我需要在卸载时删除这个 Task Scheduler 任务。Inno Setup-Uninstaller 能做到这一点吗?
操作系统:Win 7/8/10 x64
我正在使用 powershell 创建一个窗口任务,一切正常,但我找不到如何添加作者姓名。将ScheduledTask注册为描述的参数,但不适用于作者。
导出的 Windows 任务
<RegistrationInfo>
<Date>2016-05-17T16:45:54.3423362</Date>
<Author>NEED TO SET THIS</Author>
<URI>RunLauncherTask</URI>
</RegistrationInfo>
Run Code Online (Sandbox Code Playgroud)
ai 用于创建任务的代码
$principal = New-ScheduledTaskPrincipal -UserId (Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -expand UserName)
$allTasks = Get-ScheduledTask | Select TaskName
$action = New-ScheduledTaskAction -Execute "C:\Launcher.exe"
$trigger = New-ScheduledTaskTrigger -AtLogOn
$task = New-ScheduledTask -Action $action -Trigger $trigger -Principal $principal
$username = $principal.UserId
$taskName = 'RunLauncherTask' + $username.Replace('\','-')
$settings = New-ScheduledTaskSettingsSet -DontStopIfGoingOnBatteries -AllowStartIfOnBatteries
Register-ScheduledTask $taskName -Action $action -Settings $settings
Run Code Online (Sandbox Code Playgroud)
如何设置作者?
我有一个 PowerShell 脚本,我制定了每天运行的任务。是否可以打开 PowerShell 窗口(运行后不关闭),以便确保它运行时没有错误?当我使用以下命令进行调度时,没有弹出窗口,所以我不知道它是否真的完成了。
powershell -ExecutionPolicy ByPass -File “Q:\myscript.ps1” -NoExit
Run Code Online (Sandbox Code Playgroud)
此外,在脚本本身中,我有一行在记事本中打开一个文本文件(来自 Start-Transcript 的脚本脚本)。当我手动运行脚本时,它会打开记事本,但计划任务没有。有没有设置可以打开?
$validationPath = "Q:\transcript.txt"
& Notepad $validationPath
Run Code Online (Sandbox Code Playgroud) taskscheduler ×10
powershell ×3
c# ×2
future ×1
inno-setup ×1
java ×1
ms-access ×1
python ×1
python-2.7 ×1
spring ×1
vba ×1
windows ×1
windows-10 ×1