Tuesday 15 May 2012

c# - Launching command line works from linqpad, doesn't work from my executable -



c# - Launching command line works from linqpad, doesn't work from my executable -

i'm facing weird issue, i'm trying launch command programme next code, works in linqpad, if re-create paste exact same code in standalone .exe no longer works:

var cmd = "/k convert \"c:\\tesseractinput\\46a8c74d-ead1-4a6a-987f-a46b146cb58b.png\" \"c:\\tesseractoutput\\46a8c74d-ead1-4a6a-987f-a46b146cb58b.tif\""; var proc = process.start("cmd.exe", cmd); proc.waitforexit(20000);

in linqpad end command prompt , command correctly executed. in standalone exe end command promt error stating

invalid parameter - "c:\tesseractoutput\46a8c74d-ead1-4a6a-987f-a46b146cb58b.tif"

this not specific programme i'm calling (getting same issue other command line programs)

if inspect processes sysinternal's processexplorer see cmd.exe launched right passed arguments while 1 launched programme gives path "error opening process".

both linqpad , exe run same user (myself, administrator)

i looked quite while , not making progress, advice welcome blocking deployment (last step merging external tools dev did in linqpad program)

update: aaaaaaaaaaaaaaand without changing . . . works. clue have caused this?

command prompts can run different users , can run different path environment variables - path environment variable windows searches convert.exe; typically checks current folder , checks folders in path statement . http://en.wikipedia.org/wiki/path_(variable) dont' have convert program, when ran below got same error.

c:\users\user1>convert c:\temp\1.png c:\temp\2.tif invalid parameter - c:\temp\2.tif c:\users\user1>convert /? converts fat volume ntfs. convert volume /fs:ntfs [/v] [/cvtarea:filename] [/nosecurity] [/x] volume specifies drive letter (followed colon), mount point, or volume name. /fs:ntfs specifies volume converted ntfs. /v specifies convert run in verbose mode. /cvtarea:filename specifies contiguous file in root directory place holder ntfs scheme files. /nosecurity specifies security settings on converted files , directories allow access users. /x forces volume dismount first if necessary. open handles volume not valid. c:\users\user1>

c# .net command-line .net-4.5

No comments:

Post a Comment