Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 489 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Executing a batch file in an R script

#1
I would like to execute a batch file from a R script. The file is in a directory like `\\network\path\to\batch\file.bat`.

I know I can use the `system` command in R to run DOS commands but I can't simply use `system("start file.bat")`. So how would I best use R script to execute this batch file?
Reply

#2
try
shell('\\network\path\to\batch\file.bat')
Reply

#3
Try `shell.exec("\\\\network\\path\\file.bat")`

The `shell.exec` command uses the Windows-associated application to open the file. Note the double back-ticks.

Pro tip: `write.csv(file='tmp.csv',tmpdat);shell.exec('tmp.csv')` is useful (assuming you've associated CSV files with your preferred application for viewing CSV files) for quickly checking output.
Reply

#4
I found this problem when using RSelenium in Windows as well but using [this batch file][1] made sure to close all chromedriver processes. I was ending up with a ton of these processes after a lengthy scraping session.

My solution was to execute the batch file from within the R script every so often by using:

shell.exec(file.path(getwd(), "kill_chromedriver.bat"))


[1]:

[To see links please register here]

Reply

#5
This is what I did on windows platform.

cmd='\\prj\\whatkit\\test.bat'
system(cmd, intern = TRUE, show.output.on.console = TRUE)
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through