bash - W8 Registry issue? Calling shell script from within C++ app but no arguments get passed -
i have c++ program uses system()
call execute , send arguments shell script. worked fine on windows 8.1 computer. i'm trying run same thing on new windows 8.1 laptop. shell script gets executed no arguments received.
the c++ code
system(("c:/script.sh file.png &").c_str());
in shell script verify number of arguments received.
#!/bin/bash echo "received arguments: $# "
i can execute , pass arguments script manually git bash
$ sh script.sh file.png received arguments: 1
but if system()
call within c++, received arguments 0. same exact code works on other machine. problem seems related windows registry. first time ran c++ program on new laptop, windows asked me program should use execute shell script. selected powershell. yet caused powershell open/close in frenzy , had restart computer. went explorer , associated .sh opened git bash. executing script within c++ program works, safe passing of arguments.
is possible registry setting somehow prohibit passing of data?
consider calling system("/path/to/bash c:/script.sh file.png &")
make life easier os, otherwise needs launch program suggested in shebang.
Comments
Post a Comment