Source:
<code>private void startAgent(SlaveComputer computer, final TaskListener listener, String java, String workingDirectory) throws IOException { session = connection.openSession(); expandChannelBufferSize(session,listener); PrintStream logger = listener.getLogger(); boolean AlternativeWindowsDriveCheck = ! "false".equals(System.getProperty("hudson.plugins.sshslaves.alternativewindowsdrive")); String agentOSTYPE=""; try { ByteArrayOutputStream agentOsTypeStream = new ByteArrayOutputStream(); <START> connection.exec("echo \"$OSTYPE\"", agentOsTypeStream); <END> agentOSTYPE = StringUtils.chomp( agentOsTypeStream.toString(Charset.defaultCharset().name()) ); } catch (InterruptedException ex) { logger.println(Messages.SSHLauncher_UnableToGetEnvironment(getTimestamp())); AlternativeWindowsDriveCheck=false; } Pattern windowsDrivePattern = Pattern.compile("^[a-zA-Z]:\\\\"); Matcher windowsDriveMatcher = windowsDrivePattern.matcher(workingDirectory); String cdArguments = ""; if ( AlternativeWindowsDriveCheck && ! "cygwin".equals(agentOSTYPE) && windowsDriveMatcher.find() ) { cdArguments = "/d "; } String cmd = "cd " + cdArguments + "\"" + workingDirectory + "\" && " + java + " " + getJvmOptions() + " -jar " + AGENT_JAR + getWorkDirParam(workingDirectory); cmd = getPrefixStartSlaveCmd() + cmd + getSuffixStartSlaveCmd(); listener.getLogger().println(Messages.SSHLauncher_StartingAgentProcess(getTimestamp(), cmd)); session.execCommand(cmd); session.pipeStderr(new DelegateNoCloseOutputStream(listener.getLogger())); try { computer.setChannel(session.getStdout(), session.getStdin(), listener.getLogger(), null); } catch (InterruptedException e) { session.close(); throw new IOException(Messages.SSHLauncher_AbortedDuringConnectionOpen(), e); } catch (IOException e) { try { throw new AbortException(getSessionOutcomeMessage(session,false)); } catch (InterruptedException x) { throw new IOException(e); } } }</code><technical_language>Is this differ system property for os.arch others? simpler checking shell that, this approach work</technical_language>

Target:
private void startAgent(SlaveComputer computer, final TaskListener listener, String java, String workingDirectory) throws IOException { session = connection.openSession(); expandChannelBufferSize(session,listener); PrintStream logger = listener.getLogger(); boolean alternativeWindowsDriveCheck = ! "false".equals(System.getProperty("hudson.plugins.sshslaves.alternativewindowsdrive")); String agentOSTYPE=""; try { ByteArrayOutputStream agentOsTypeStream = new ByteArrayOutputStream(); connection.exec("echo \"$OSTYPE\"", agentOsTypeStream); agentOSTYPE = StringUtils.chomp( agentOsTypeStream.toString(Charset.defaultCharset().name()) ); } catch (InterruptedException ex) { logger.println(Messages.SSHLauncher_UnableToGetEnvironment(getTimestamp())); alternativeWindowsDriveCheck=false; Thread.currentThread().interrupt(); } Matcher windowsDriveMatcher = windowsDrivePattern.matcher(workingDirectory); String cdArguments = ""; if ( alternativeWindowsDriveCheck && ! "cygwin".equals(agentOSTYPE) && windowsDriveMatcher.find() ) { cdArguments = "/d "; } String cmd = "cd " + cdArguments + "\"" + workingDirectory + "\" && " + java + " " + getJvmOptions() + " -jar " + AGENT_JAR + getWorkDirParam(workingDirectory); cmd = getPrefixStartSlaveCmd() + cmd + getSuffixStartSlaveCmd(); listener.getLogger().println(Messages.SSHLauncher_StartingAgentProcess(getTimestamp(), cmd)); session.execCommand(cmd); session.pipeStderr(new DelegateNoCloseOutputStream(listener.getLogger())); try { computer.setChannel(session.getStdout(), session.getStdin(), listener.getLogger(), null); } catch (InterruptedException e) { session.close(); throw new IOException(Messages.SSHLauncher_AbortedDuringConnectionOpen(), e); } catch (IOException e) { try { throw new AbortException(getSessionOutcomeMessage(session,false)); } catch (InterruptedException x) { throw new IOException(e); } } }