Search code examples
perlunixcygwinspawn

how to run system command in perl script with Cygwin


I'm trying to implement a perl script in Cygwin. The script makes a few different calls within. For example,

system "C:\\users\\program.exe"; 

or

exec("C:\\users\\program.exe");

When I try to run it in cygwin, it gives me the error:

sh: C:cygwin64cygdriveprogram.exe: command not found

I know this is a dumb question, but how do I make it find program.exe?? If I look through the directory in the cygwin terminal then program.exe is clearly there...

Once I have it find the program, I would like to spawn the new process in a new cygwin terminal.


Solution

  • Use Unix file separators and the /cygdrive/c/ virtual drive:

    system "/cygdrive/c/users/program.exe"; 
    

    or

    exec("/cygdrive/c/users/program.exe")