我在C#中使用Visual Studio開發了程序,並在Debug文件夾中生成了.exe文件。我還在Properties-> Debug中添加了命令行參數。從命令提示符處運行.exe文件
傳遞的PARAMS是d:\實施例\ BIN \發佈\ Input_Files \ d:\實施例\ BIN \調試\ trycc.css 900 640
運行通過標記溶液的配置調試此解決方案,它產生Debug文件夾中的.exe文件。
當我試圖從命令行運行時,它告訴無法打開某個與.exe相同級別的文件。
D:\>D:\Example\bin\Debug\Example.exe D:\Example\bin\Release\Input_Files\ D:\Example\bin\Debug\trycc.css 900 640
我不明白我要去哪裏錯了。請幫助。
這就是:
D:\>D:\Example\bin\Debug\DFu1.exe "D:\Example\bin\Release\I
nput_Files\" "D:\Example\bin\Release\Input_Files\css\screen.css" "900
" "830"
Incomplete Arguments entered.
Press any key to continue
Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part
of the path 'C:\Out\elogs.txt'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at ExampleParser.Program.Main(String[] args) in D:\Example\Program.cs:l
ine 691
這可能是工作目錄的問題,或者您需要將參數放在引號「」之間。你能從命令提示符複製 - 粘貼整個輸出嗎?如果你不知道怎麼做 - 右鍵單擊命令提示符窗口,選擇線條,單擊鼠標右鍵,它會在你的剪貼板中(你可以比CTRL + V在這裏)。 – kape123
我編輯了..請看看 – Aada