0

Using Cygwin on my local machine, the following Perl code works:

system "cmd /c start 'c:\\cygwin\\home\\fl\\CSmtp_prac.exe'";

when I try to move the Perl file on to Windows SQL server 2008, I can't get it to run.

It says it can't find it on the server even though it is indeed there and I have updated the path to do so. The icon of the perl file is of perl so I know the server has perl on it. I'm wondering what is wrong with my syntax.

Here's what I have on the perl file that is on the server: system "cmd /c start 'c:\PDAutomation\CSmtp_prac.exe'";

mob
  • 117,087
  • 18
  • 149
  • 283
  • I doubt you will get an answer to this question until you use a regular Perl script rather than a .exe file. How are we supposed to know how you put that .exe together. There are a thousand things you could have done wrong. – djangofan May 10 '13 at 22:29
  • The .exe file runs on the local machine with the perl script. I just want to transfer what works on the local machine to the server. The perl script calls the .exe file. – vendetta1 May 10 '13 at 22:39
  • ok, but even though you say that, the question is still not very clear. for example, this question is much clearer: http://stackoverflow.com/questions/2907494/running-a-batch-file-from-perl-activestate-perl-in-windows?rq=1 – djangofan May 12 '13 at 16:22
  • With an exe, you may not have bundled all the required dependencies. The exe would work on your build machine but, not on the deployed machine. perl -v output on each host to start with. – user3183018 Jan 14 '14 at 22:47

1 Answers1

0

Lose the single quotes inside the system call. They are fine in Cygwin and the bash shell, but in the Windows shell it will look for filenames with a literal ' character in them.

Try one of these instead, which should work in both Cygwin and MSWin32:

system 'cmd /c start c:\cygwin\home\fl\CSmtp_prac.exe';
system q(cmd /c start c:\cygwin\home\fl\CSmtp_prac.exe);
system "cmd /c start c:\\cygwin\\home\\fl\\CSmtp_prac.exe";
system qq(cmd /c start c:\\cygwin\\home\\fl\\CSmtp_prac.exe);
mob
  • 117,087
  • 18
  • 149
  • 283