Hello,
I’m trying to run .exe file, but Julia command doesn’t seem to work correctly.
.bat file that works:
cmd /min /C "set __COMPAT_LAYER=RUNASINVOKER && start "" "C:/Users/User/AppData/Local/Programs/My Program.exe""
Julia command doesn’t work:
run(`cmd /min /C "set __COMPAT_LAYER=RUNASINVOKER && start "" "C:/Users/User/AppData/Local/Programs/My Program.exe""`; wait=false)
Process(`cmd /min /C 'set __COMPAT_LAYER=RUNASINVOKER && start C:/Users/User/AppData/Local/Programs/My' Program.exe`, ProcessRunning)
I couldn’t figure out how to fix this.
Escape the embedded quotes: run(`cmd /min /C "set __COMPAT_LAYER=RUNASINVOKER && start \"\" \"C:/Users/User/AppData/Local/Programs/My Program.exe\""`; wait=false)
Thanks for reply, but that didn’t work for me. Getting windows error:
julia> run(`cmd /min /C "set __COMPAT_LAYER=RUNASINVOKER && start \"\" \"C:/Users/User/AppData/Local/Programs/My Program.exe\""`; wait=false)
Process(`cmd /min /C 'set __COMPAT_LAYER=RUNASINVOKER && start "" "C:/Users/User/AppData/Local/Programs/My Program.exe"'`, ProcessRunning)
Windows cannot find '\\'.
I am not sure how to fix your original problem.
What is the purpose of the two double quotes after start?
But as a workaround (if you have not done so already) you could consider to create the .bat file with Julia and then run it.
you may want to consider mktempdir()
to create a temporary directory.
1 Like
Thanks for suggestion. Before implementing your workaround I thought I’d give one last run at quoting random parts of command. I finally succeeded, but have no idea why this is working and previous one isn’t.
run(`cmd /min /C set __COMPAT_LAYER=RUNASINVOKER '&&' start '' 'C:/Users/User/AppData/Local/Programs/My Program.exe'`; wait=false)
Double quotes after start are needed to pass second argument.