C# - passing arguments with space in between them to a process -
i'm trying pass argument process folder space in name. doesn't recognize folder. how can that?
string my_arg = @"c:\\program files\\my folder spaces"; processstartinfo proc = new processstartinfo(); proc.filename = @"c:\batches\my_batch.bat"; proc.arguments = @my_arg ; process.start(proc); the process wont start - work if use folder no spaces in name. thank you!
you’re using literal strings; there no need escape backslashes, , indeed if there’s no need use literal string in first place.
the spaces on other hand require special care – encase argument quotes solves this.
string my_arg = @"""c:\program files\my folder spaces""";
Comments
Post a Comment