Title: `main` 函数和命令行参数 (C++) | Microsoft Learn
Open Graph Title: `main` 函数和命令行参数 (C++)
Description: `main` 函数是 C++ 程序的入口点。
Open Graph Description: `main` 函数是 C++ 程序的入口点。
Opengraph URL: https://learn.microsoft.com/zh-cn/cpp/cpp/main-function-command-line-args?view=msvc-170
Domain: learn.microsoft.com
| color-scheme | light dark |
| twitter:card | summary_large_image |
| og:type | website |
| og:image:alt | Microsoft Learn |
| og:image | https://learn.microsoft.com/en-us/media/open-graph-image.png |
| platform_id | f91017dc-d7f8-a55b-a696-4ed862e21988 |
| scope | C++ |
| locale | zh-cn |
| uhfHeaderId | MSDocsHeader-CPP |
| page_type | conceptual |
| schema | Conceptual |
| audience | developer |
| author | TylerMSFT |
| breadcrumb_path | ../_breadcrumb/toc.json |
| default_moniker | msvc-170 |
| depot_name | VS.vcppdocs |
| document_id | e0c5ec8f-dc90-d0bd-5aa5-1340ccc877c3 |
| document_version_independent_id | 19646aca-3da3-14e8-ea9a-fcb3020cf51c |
| feedback_help_link_type | get-help-at-qna |
| feedback_help_link_url | https://learn.microsoft.com/en-us/answers/tags/314/cpp |
| feedback_product_url | https://developercommunity.visualstudio.com/cpp/ |
| feedback_system | Standard |
| git_commit_id | cf14bbcf24ff9ea71908a64a93c69c737ec7a42b |
| gitcommit | https://github.com/MicrosoftDocs/cpp-docs-pr/blob/cf14bbcf24ff9ea71908a64a93c69c737ec7a42b/docs/cpp/main-function-command-line-args.md |
| manager | coxford |
| monikers | msvc-180 |
| ms.author | twhitney |
| ms.date | 2020-12-16T00:00:00Z |
| ms.service | visual-cpp |
| ms.subservice | cpp-lang |
| ms.tgt_pltfrm | Windows |
| ms.topic | language-reference |
| ms.update-cycle | 1095-days |
| ms.workload | cplusplus |
| original_content_git_url | https://github.com/MicrosoftDocs/cpp-docs-pr/blob/live/docs/cpp/main-function-command-line-args.md |
| ROBOTS | INDEX,FOLLOW |
| site_name | Docs |
| updated_at | 2025-11-07T02:10:00Z |
| ms.translationtype | MT |
| ms.contentlocale | zh-cn |
| loc_version | 2025-08-01T05:10:13.1327218Z |
| loc_source_id | Github-70020392#live |
| loc_file_id | Github-70020392.live.VS.vcppdocs.cpp/main-function-command-line-args.md |
| toc_rel | toc.json |
| search.mshattr.devlang | cpp |
| word_count | 2419 |
| asset_id | cpp/main-function-command-line-args |
| item_type | Content |
| previous_tlsh_hash | 53D987E1D8332578A7F8013E38FFE164B74A131F8DB22DC73CC4D389305DD932CA64B61A2A9D425849EB019361EDB76385783161A7F693EFC2124BA0CEA55DA5043E951EAD |
| github_feedback_content_git_url | https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/cpp/main-function-command-line-args.md |
| markdown_url | https://learn.microsoft.com/zh-cn/cpp/cpp/main-function-command-line-args?view=msvc-170&accept=text/markdown |
Links:
Viewport: width=device-width, initial-scale=1.0