English 中文(简体)
将空间特性替换为什么?
原标题:Replace space characters in paths with what?

I start bash from Java app and I have in my path for command which executes inside bash spaces ( example cd /Documents and Settings/test ), I run command with Process Builder but it doesn t work when path have spaces. I try to replace spaces with %20 but not help. What to do ?

最佳回答

你们要么可以把全部道路推到引号上:

String quoted = """ + pathString + """;

或者,当你使用巴什时,越狱:

String escaped = pathString.replace(" ", "\ ");

两者都应作为你的<条码>cd指挥的论据。

问题回答

概括了报价之间的整个道路。

cd "/Documents and Settings/test"

在这里使用“20%”是非专利的,它没有“URL”。 利用Sting[] 或 List[] 而不是“Sting”,然后,你可以离开空间,在那里没有更细微的分界线。

因此,你可以使用

"cd", "/Documents and Settings/test"

然而,这并不意味着指挥员。 当你重新开始新的进程时,你可以改变 Java的工作ir。 你可能想写出一张彩票(批量文件),并从 Java取。

You need to run a command which works from the bash prompt. e.g. cd /Document and Settings/ won t. Try cd C:Documents and Settings which does.

NOTE: bash requires you use a C: at the start to access this folder. Using just / at the start will give you cygwin s a virtual root.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签