Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7513897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:19:40+00:00 2026-05-30T00:19:40+00:00

Sorry if I am Re-opening the same Question again. I want to Run Two

  • 0

Sorry if I am Re-opening the same Question again. I want to Run Two Commands

  1. D:\cygwin\bin\Test

  2. sh app.sh AK-RD 02.20 D:\cygwin\bin\Test_files

Above are the two commands i want to run in the same command prompt Means i have to go inside D:\cygwin\bin\Test Folder and on the same prompt want to run next command

sh app.sh AK-RD 02.20 D:\cygwin\bin\Test_files

The command will look like,

Command:- D:\cygwin\bin\Test>sh app.sh AK-RD 02.20 D:\cygwin\bin\Test_files

How to do this using process Builder in java. Or is there any other way to do this.

String cmd;   
   cmd = "sh app.sh AK-RD 02.20 D:\\cygwin\\bin\\Test_files";
    ProcessBuilder probuilder = new ProcessBuilder( cmd );
    probuilder.directory(new File("D:\\cygwin\\bin\\Test"));
    Process process = probuilder.start();

This is not Helping me, Even if i change probuilder.directory in the code. I am getting

Cannot run program "'sh app.sh AK-RD 02.20 D:\\cygwin\\bin\\Test_files  CreateProcess error=2, The system cannot find the file specified
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:19:42+00:00Added an answer on May 30, 2026 at 12:19 am

    The error means the system can’t find the file sh app.sh AK-RD 02.20 D:\\cygwin\\bin\\Test_files.exe in the path.

    This means that ProcessBuilder interprets the whole string (including backslashes and spaces and everything) as command name. This is not what you want.

    Split the command into individual words:

    ProcessBuilder pb = new ProcessBuilder( "sh", "app.sh", "AK-RD", "02.20", "D:\\cygwin\\bin\\Test_files" );
    

    and use pb.directory() to CD into the correct directory.

    Alternatively, put everything into a BAT/CMD script and run that with ProcessBuilder

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sorry for opening a new question, I had to - as I wrote
Sorry for opening this topic again, but thinking about this topic itself has started
it is showing me following error when i m opening http://localhost:3000/store **We're sorry, but
Sorry for the basic question - I'm a .NET developer and don't have much
Sorry for this not being a real question, but Sometime back i remember seeing
Sorry for the second newbie question, I'm a developer not a sysadmin so this
Sorry if this sounds like a really stupid question, but I need to make
My GWT JavaScript app prints reports by opening a new browser window programmatically, filling
Just a syntax question, here is my code snippet. (Sorry, browser isn't letting me
Objective I want to be able to run the Applescript to open multiple applications

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.