1

I have a base directory, call it MAIN and two subfolders, SCRIPTS and WORK. When using the following line of code, the script calls upon the job and runs it, only if job_name is in the MAIN folder, then prints output or error to job_name.out/.err in the WORK folder.

system("$job_name > ./WORK/$job_name.out 2> ./WORK/$job_name.err");

If I move the jobs into SCRIPTS then I cannot seem to find an efficient/simple way to call upon it.. I figured something similar to the following code would work:

system("SCRIPTS/$job_name > ./WORK/$job_name.out 2> ./WORK/$job_name.err");

But I get errors like:

  • SCRIPTS is not recognized as an internal or external command......
  • The system cannot find the path specified.

How can I compose this command to get it to work from a subdirectory?

3
  • Where do you execute your script from in the second case? Your MAIN folder ? is writting ./SCRIPTS/$job_name changing anything ? Commented Jun 2, 2014 at 14:44
  • 3
    "But I cannot get it to work!" is not an adequate problem description. Commented Jun 2, 2014 at 14:45
  • 2
    Sorry ikegami, the errors I received varied depending on the syntax I was using, I was getting errors from "SCRIPTS is not recognized as an internal or external command......" to "The system cannot find the path specified." I will be sure to be more specific in future questions! Commented Jun 2, 2014 at 15:43

1 Answer 1

3

On Windows, filepaths are specified with backslashes (\).

Instead of system("SCRIPTS/$job_name"...), try system("SCRIPTS\\$job_name"...)

Sign up to request clarification or add additional context in comments.

4 Comments

I thought about that as well, but then how could his 1st example have worked ?
@Ploutox : Windows is more picky about the path to the command being run than that of the output redirection. Try it out with C:\> echo "Hi" > ./some_subdir/test.txt
Oh ok. I didn't think you could have an hybrid syntax like that. I'm more of a Linux person myself ...
@Ploutox : Windows is quite quirky. I think the / came into the picture with Windows NT 4.0 when they implemented/copied a lot of Unix's functionality (pipes, etc.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.