用 R system() 解压 rar [英] unpacking rar with R system()
本文介绍了用 R system() 解压 rar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好吧,这个任务似乎真的很容易做.但是我花了几个小时没有任何结果.
OK this task seems to be really easy to do. However I spent a couple of hours without any results.
用户拥有:
- 7z
- 窗户
- R
用户应输入:
- 7z 路径(z7path)
- 文件名
系统应将 rar 解压到项目的根目录中
System should unpack rar into the project's root
我试过了:
cmd = "C:\\Program Files (x86)\\7-Zip\\7z e D:/20140601.rar"
system(shQuote(cmd))
然后……什么也没发生.请不要建议设置 PATH,它没有帮助,没有它应该可以工作.
And..nothing happens. Please don't advise to set up PATH, it doesn't help, and this should work without it.
推荐答案
好的,我终于明白了.
- 使用外壳
- 对周围路径使用 shQuote
使用右键
- Use shell
- Use shQuote for surrounding path
Use right keys
z7path = shQuote('C:\\Program Files (x86)\\7-Zip\\7z')
file = paste(getwd(), '/101-01.rar', sep = '')
cmd = paste(z7path, ' e ', file, ' -y -o', getwd(), '/', sep='')
shell(cmd)
这篇关于用 R system() 解压 rar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文