mapping - Drive won't map in Java if there is whitespace in name -
i'm trying map drive in java. code runs fine, drive isn't mapped.
zing =  "m: \\\\ds-file2-2\\quality archive"; string command = "c:\\windows\\system32\\net.exe use " + zing; process p = runtime.getruntime().exec(command); i've tried map other folders on server , work. i've tried mapping drive in windows , works. tried mapping folder spaces , failed. thought quotes capture space in name. no errors occur.
thanks in advance!
your issue want quotes surrounding string appear when command executed.  aren't adding quotes.  in current state, command c:\\windows\\system32\\net.exe use m: \\\\ds-file2-2\\quality archive.  assume want c:\\windows\\system32\\net.exe use "m: \\\\ds-file2-2\\quality archive".  
in case, change zing zing = "\"m: \\\\ds-file2-2\\quality archive\"".  escaping quotes with\", , thuscommandbecomesc:\windows\system32\net.exe use "m: \\ds-file2-2\quality archive"`.  
your code above become this:
zing =  "\"m: \\\\ds-file2-2\\quality archive\""; string command = "c:\\windows\\system32\\net.exe use " + zing; process p = runtime.getruntime().exec(command); 
Comments
Post a Comment