public class WindowsUtil extends Object
Constructor and Description |
---|
WindowsUtil() |
Modifier and Type | Method and Description |
---|---|
static File |
createJunction(File junction,
File target)
Creates an NTFS junction point if supported.
|
static Process |
execCmd(String... argv)
Executes a command and arguments using
cmd.exe /C ... . |
static String |
quoteArgument(String argument)
Quotes an argument while escaping special characters interpreted by CreateProcess.
|
static String |
quoteArgumentForCmd(String argument)
Quotes an argument while escaping special characters suitable for use as an argument to
cmd.exe . |
@NonNull public static String quoteArgument(@NonNull String argument)
argument
- argument to be quoted or escaped for windows shells.@NonNull public static String quoteArgumentForCmd(@NonNull String argument)
cmd.exe
.argument
- argument to be quoted or escaped for cmd.exe
.cmd.exe
.@NonNull public static Process execCmd(String... argv) throws IOException
cmd.exe /C ...
.argv
- arguments to be quoted or escaped for cmd.exe /C ...
.cmd.exe /C ...
.IOException
@NonNull public static File createJunction(@NonNull File junction, @NonNull File target) throws IOException, InterruptedException
junction
- NTFS junction point to createtarget
- target directory to junctionIOException
- if the call to mklink exits with a non-zero status codeInterruptedException
- if the call to mklink is interrupted before completingUnsupportedOperationException
- if this method is called on a non-Windows platformCopyright © 2004–2021. All rights reserved.