## Problem 

Compiling .qmd docs from Windows PowerShell works fine. But while trying to compile from Rstudio it fails. 


## Reprex 

The test file I'm using comes from the official quarto website: https://quarto.org/docs/get-started/hello/rstudio/_hello.qmd

## Tried attempts 

### Powershell
Running `quarto render hello.qmd` within PowerShell works perfectly.

### Rstudio

#### Render Button
If I open the `hello.qmd` file in Rstudio en press the Render button I got the following error: 

```
Message d'avis :
Dans system(paste0("quarto render \"", input, "\" ", "--to default")) :
  'CreateProcess' a échoué au lancement de 'C:\Users\TGOOSS~1\AppData\Local\Programs\Quarto\bin\quarto.cmd render "C:/Users/tgoossens/Desktop/test_rmarkdown/test.qmd" --to default'
```

#### R console 

If I call `quarto::quarto_render(hello.qmd)` from the R console I got the following error:

```
Error in `process_initialize(self, private, command, args, stdin, stdout, …`:
! Native call to `processx_exec` failed
Caused by error in `chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …`:
! create process 'C:\Users\TGOOSS~1\AppData\Local\Programs\Quarto\bin\quarto.cmd' (system error 2, The system cannot find the file specified.
) @win/processx.c:1040 (processx_exec)
Type .Last.error to see the more details.
```
Result from `quarto::quarto_path()` : 

`[1] "C:\\Users\\TGOOSS~1\\AppData\\Local\\Programs\\Quarto\\bin\\quarto.cmd"`

Result from `quarto::quarto_version()`:

```
Error in system2(quarto_bin, "--version", stdout = TRUE) : 
  'CreateProcess' failed to run 'C:\Users\TGOOSS~1\AppData\Local\Programs\Quarto\bin\quarto.cmd --version'
```

## Session info : 
```
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=French_Belgium.utf8  LC_CTYPE=French_Belgium.utf8    LC_MONETARY=French_Belgium.utf8
[4] LC_NUMERIC=C                    LC_TIME=French_Belgium.utf8    

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9      ps_1.7.1        digest_0.6.29   later_1.3.0     R6_2.5.1        jsonlite_1.8.0 
 [7] evaluate_0.15   rlang_1.0.4     cli_3.3.0       rstudioapi_0.13 rmarkdown_2.14  tools_4.2.1    
[13] glue_1.6.2      xfun_0.31       yaml_2.3.5      fastmap_1.1.0   compiler_4.2.1  processx_3.7.0 
[19] htmltools_0.5.3 knitr_1.39      quarto_1.2 
```

## Similar issues/threads : 

* https://community.rstudio.com/t/failed-to-run-c-pdflatex-exe/49079/4
* https://github.com/rstudio/tinytex/issues/208
* https://github.com/rstudio/rstudio/issues/5681
* https://community.rstudio.com/t/error-generating-pdf-in-r-markdown/60003

## Remark 

The problem was privately discussed with @cderv 


=========

Thanks or your help
 
cderv
2022-08-09T14:19:59Z
pokyah
v1.2
closed
Quarto-cli called from Rstudio throws 'CreateProcess' failed to run
https://github.com/quarto-dev/quarto-cli/issues/1760