CooperBuckeye05
CooperBuckeye05

Reputation: 159

execute a batch file (psexec.exe) from R console

I am running a redis server to expand the amount of cores for machine learning algorithms. To create workers on another computer I need to execute a batch file that starts them up on a networked computer. I can start them on my local machine and get them running on the remote machine through psexec.exe command in a .bat file. However I also need to be able to invoke this .bat file from my R console to make it an all in one system so I do not have to start them manually every time I run a new model.

when I run a system(command) in R console to start the .bat file I get an error:

'PsExec.exe' is not recognized as an internal or external command,
operable program or batch file.
Warning message:
running command 'C:\remoterun.bat' had status 1 

my system command invoked is:

system("C:\\remoterun.bat")

Is it possible to execute the .bat file in R to run outside of R? Is there another cmd type command that I can run that will do the same as psexec that I can run in R?

Thanks!

Upvotes: 0

Views: 392

Answers (1)

Paul Benton
Paul Benton

Reputation: 36

It looks like the PsExec.exe path isn't defined inside the bat file. You could add the PsExec.exe path to your windows path. Have a look here for help on windows paths: http://www.computerhope.com/pathhlp.htm You could also have a look at the shell() command, something like the below for a test.

res <- shell("date /T", intern=TRUE)

Hope it helps.

Upvotes: 1

Related Questions