{"id":170,"date":"2010-01-19T12:09:33","date_gmt":"2010-01-19T12:09:33","guid":{"rendered":"http:\/\/www.cclo.idv.tw:8080\/blogs\/wordpress\/?p=170"},"modified":"2010-01-19T12:09:33","modified_gmt":"2010-01-19T12:09:33","slug":"c_sharp_get_path_to_executable","status":"publish","type":"post","link":"https:\/\/blog.cclo.idv.tw\/?p=170","title":{"rendered":"[C#] \u53d6\u5f97\u57f7\u884c\u6a94\u6240\u5728\u76ee\u9304\u7684\u65b9\u6cd5"},"content":{"rendered":"<p><strong>\u65b9\u6cd5\u4e00\uff1a<\/strong><\/p>\n<pre><code class=\"language-csharp\">System.Reflection.Assembly a = System.Reflection.Assembly.GetEntryAssembly();\nstring baseDir = System.IO.Path.GetDirectoryName(a.Location);<\/code><\/pre>\n<p><strong>\u65b9\u6cd5\u4e8c\uff1a<\/strong><\/p>\n<pre><code class=\"language-csharp\">string baseDir = Application.ExecutablePath;\nbaseDir = baseDir.Remove( baseDir.LastIndexOf(&#039;\\\\&#039;));  \/\/ \u53bb\u6389\u57f7\u884c\u6a94\u90e8\u4efd<\/code><\/pre>\n<p>\u53c3\u8003\u8cc7\u6599\uff1a<a href=\"http:\/\/bytes.com\/topic\/c-sharp\/answers\/252592-how-can-i-get-my-exe-path\">http:\/\/bytes.com\/topic\/c-sharp\/answers\/252592-how-can-i-get-my-exe-path<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b9\u6cd5\u4e00\uff1a System.Reflection.Assembly a = System.Reflection.A [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13],"tags":[],"table_tags":[],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category--computer-science"],"aioseo_notices":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=170"}],"version-history":[{"count":0,"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/170\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=170"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/blog.cclo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftable_tags&post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}