I have created one automated test which is running a bat file. This abc.bat is generated using application assembler plug-in. Inside bat file, class path has been set and Java commands has been executing). On Linux, it's working fine, but on Windows environment, I am getting the error of:
The input line is too long
The path from which batch file is executing is C:\build\work\work1\abc\abc.bat
. I have to keep this path, can't reduce it to like C:\build\abc.bat
.
I am using process builder to run this abc.bat file.
public Test(Path wp, Path exe) throws IOException {
builder = new ProcessBuilder()
.directory(wp.toFile())
.command(wp.resolve(exe).toAbsolutePath().toString())
.redirectOutput(Redirect.INHERIT)
.redirectError(Redirect.INHERIT);
builder.start();
}
Path wp contains the path of C:\build\work\work1. (I am fetching this path from system environment variables). Path exe contains the path of abc\abc.bat
I have done some research and found out that long path issue can be fixed by changing group policy as shown below:
Hit the Windows key, type gpedit.msc and press Enter.
Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem
and enable win32 long paths.
This doesn't work for me. I am using Windows 10 enterprise, OS build is 14393.1593.
Another way is using Subst command. Manually I can map the drive using command prompt like:
C:\build> Subst X: “C:\build\work\work1”
X:\>abc\abc.bat
It works fine and there is no issue of "The input line is too long". Is this a good way to overcome this issue? and how to automate this using process builder?