I have the following line that I am trying to transfer to system
on a Win 7 machine. It should create a .git
directory in the repo, but it does not work with system
(although this approach works in a Linux box, so this is a problem with Windows).
system( "cd C:/Users/trinker/Desktop/foo2 && \"C:\\Program Files (x86)\\Git\\bin\\git.exe\" init" )
C:/Users/trinker/Desktop/foo2
is the repo location. C:\\Program Files (x86)\\Git\\bin\\git.exe
is the location of git on my system.
When I run above, nothing happens. No posts, over. But I run cat
on the line and paste it directly into the command line it launches, it displays the following message and creates .git
in the appropriate place.
This is how it works ...
cat("cd C:/Users/trinker/Desktop/foo2 && \"C:\\Program Files (x86)\\Git\\bin\\git.exe\" init")
Paste this into the command line ...
cd C:/Users/trinker/Desktop/foo2 && "C:\Program Files (x86)\Git\bin\git.exe" init
Gives ...
Initialized empty Git repository in C:/Users/trinker/Desktop/foo2/.git/
... What well
So I can do this outside of R with the same line, but not inside R. What do I need to do for the first line, where I use system
so that it runs as if I were cat
and inserted into the command line? The answer is great, but I would like to know what is happening here, so I can turn to similar circumstances in the future with access to the Windows command line using system
.
source share