[R] Windows: URL associations do not work in scheduled tasks

Dan Tenenbaum dtenenba at fredhutch.org
Mon Aug 17 22:15:05 CEST 2015


Hi,

I have a script called test.R which contains:

browseURL("http://r-project.org")

It works fine when I run it interactively or with "R -f test.R" when logged in as the user 'biocbuild'.

However, if I set up a Scheduled Task to run the script as that same user (with the XML definition below) it outputs the following:

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> browseURL("http://r-project.org")
Error in shell.exec(url) :
  file association for 'http://r-project.org' not available or invalid
Calls: browseURL -> shell.exec
Execution halted

I tried granting the user that the task runs as (biocbuild) the Log On As A Service right (per https://technet.microsoft.com/en-us/library/Cc739424(v=WS.10).aspx) but that did not make a difference.


This is on 

> sessionInfo()
R version 3.2.2 RC (2015-08-06 r68871)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2012 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
>


I note that I do not have the same issue with Windows Server 2008; I am seeing it now in Windows Server 2012.


Here is the task definition:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2015-08-17T14:03:12.3440388</Date>
    <Author>WINDOWS1\Administrator</Author>
  </RegistrationInfo>
  <Triggers />
  <Principals>
    <Principal id="Author">
      <UserId>WINDOWS1\biocbuild</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>C:\biocbld\bbs-3.2-bioc\R\bin\R.exe</Command>
      <Arguments>-f test.R > out 2>&1</Arguments>
      <WorkingDirectory>c:\biocbld\bbs-3.2-bioc\meat</WorkingDirectory>
    </Exec>
  </Actions>
</Task>

Thanks in advance for any help,
Dan



More information about the R-help mailing list