It will be called 1.bat and run as onlogon?
SCHTASKS /Create /tn "1" /tr %Systemdrive%\1\1.bat /sc onlogon /ru ""
Any help with a task that will run a batch silently would be appreciated

Moderator: DosItHelp
foxidrive wrote:If it triggers UAC then you can't get around that, otherwise someone could do what you are doing and get malware to install easily.
Code: Select all
start /min
ShadowThief wrote:Closest thing I can find would be to try calling the batch file withwhich MIGHT work, but I haven't tested it.Code: Select all
start /min
Code: Select all
schtasks /create /tn "Rearm" /tr "'%%SystemDrive%%\Windows\system32\cmd.exe' /c cscript.exe /b C:\Windows\System32\slmgr.vbs /rearm && net stop sppsvc && net start sppsvc" /sc daily /mo 30 /ru "" /f
Code: Select all
schtasks /create /tn "Tour" /tr "%SystemDrive%\LAS\7.bat" /sc onstart /ru ""
Code: Select all
schtasks /create /tn "Defrance" /tr "%SystemDrive%\Semi\5.bat" /sc daily /mo 1 /ru ""
Code: Select all
schtasks /create /tn "task1" /tr "%SystemDrive%\1.bat" /sc onlogon /ru "" >nul
Code: Select all
SCHTASKS /Run [Connect_Options] /TN taskname
ShadowThief wrote:Doesn't look like you can run the task with the same command you use to create the task, but you can manually run a task withCode: Select all
SCHTASKS /Run [Connect_Options] /TN taskname
Code: Select all
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-10-21T14:41:03.8192848</Date>
<Author>Jesus-PC\Jesus</Author>
</RegistrationInfo>
<Triggers>
<RegistrationTrigger>
<Enabled>true</Enabled>
</RegistrationTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>Jesus-PC\Jesus</UserId>
<LogonType>Password</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>%systemdrive%\remove1.bat</Command>
</Exec>
</Actions>
</Task>
serverdelux wrote:I want to create a task that runs as soon as it created
Code: Select all
schtasks /create /tn "task1" /tr "%SystemDrive%\1.bat" /sc onlogon /ru "" >nul
schtasks /run /tn "task1"
ShadowThief wrote:serverdelux wrote:I want to create a task that runs as soon as it createdCode: Select all
schtasks /create /tn "task1" /tr "%SystemDrive%\1.bat" /sc onlogon /ru "" >nul
schtasks /run /tn "task1"
Code: Select all
schtasks /create /tn "Task1" /tr "%SystemDrive%\1.bat" /sc onlogon /ru ""
Code: Select all
schtasks /create /tn "Task1" /tr "%SystemDrive%\1.bat" /sc onlogon /ru ""
Code: Select all
start /min
Code: Select all
schtasks /create /tn "T1" /tr "cmd.exe /c start /b /min C:\1\2\1.bat" /sc onlogon /ru ""
Code: Select all
schtasks /create /tn "T1" /tr "cmd.exe /c start /b /min C:\1\2\1.bat" /sc onlogon /rl highest /f
zoeyku wrote:What is going on here?
Code: Select all
Const HIDDEN_WINDOW = 12
if WScript.Arguments.Count = 0 then
WScript.Echo "Missing parameters"
end if
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("Wscript.Arguments(0)", null, objConfig, intProcessID