如何从命令行创建 Windows 拨号连接

发布于 2024-12-25 18:18:33 字数 271 浏览 2 评论 0原文

如何从命令行在 Windows 上创建拨号连接?

我所说的“创建”并不是指如何建立现有连接,而是指如何创建新的拨号连接。常见的方法是使用新的连接向导(GUI),但我想从命令行(脚本)创建(和删除)连接。

我想在需要时创建拨号连接,因为如果没有可用的互联网连接,窗口会弹出一个对话框,要求使用拨号连接进行连接,这会阻止请求连接的程序。如果拨号连接不存在,则不会发生这种情况。禁用拨号连接上的“默认连接”设置不会阻止弹出该对话框。

How do I create dial-up connection on windows from the command line?

By "create" I do not mean how to establish an existing connection, but how to create a new dial-up connection. The common way is to use the new connection wizard (GUI), but I want to create (and delete) the connection from the command line (script).

I want to create the dial-up connection only when needed, because if no internet connection is available windows pops up a dialog asking to connect using the dial-up connection, which blocks programs requesting a connection. This does not happen if the dial-up connection does not exist. Disabling the "default connection" setting on the dial-up connection does not prevent the dialog to pop up.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

转身泪倾城 2025-01-01 18:18:33

您是否看过 Microsoft 自己的有关使用 rasphone.exe 设置(创建)拨号连接的页面?

http://support.microsoft.com/kb/555935

How to setup dial-up connection by rasphone.exe command
Click Start, type rasphone -a in the Start Search box, and then press Enter key.
Click Dial-up button on the How do you want to connect page.
Type the telephone number and destination name(e.g. Dial-Up), on the Type the telephone number to connect to page, click Next button to continue.
Type your user name and password, and make sure the Remember this password check box has been selected, on the Type your user name and password page, click Create button to continue.
Click Start, type rasphone -e <destination name> in the Start Search box, and then press Enter key.
Note: you must use the destination name which typed in step3, for example, Dial-Up. 
On the Options tag of the Dial-up Properties, Clear the following selection:
a. Prompt for name and password, certificate, etc.
b. Include Windows logon domain.
c. Prompt for phone number.
then click Ok button.

我在这里看到的问题是仍然涉及点击。
这可能不是您梦想的解决方案,但对于这些部分,您可以创建一个简短的 AutoHotkey 脚本(或为整个就此而言,过程)。

Have you seen Microsoft's own page about setting up (creating) a dial-up connection using rasphone.exe?

http://support.microsoft.com/kb/555935

How to setup dial-up connection by rasphone.exe command
Click Start, type rasphone -a in the Start Search box, and then press Enter key.
Click Dial-up button on the How do you want to connect page.
Type the telephone number and destination name(e.g. Dial-Up), on the Type the telephone number to connect to page, click Next button to continue.
Type your user name and password, and make sure the Remember this password check box has been selected, on the Type your user name and password page, click Create button to continue.
Click Start, type rasphone -e <destination name> in the Start Search box, and then press Enter key.
Note: you must use the destination name which typed in step3, for example, Dial-Up. 
On the Options tag of the Dial-up Properties, Clear the following selection:
a. Prompt for name and password, certificate, etc.
b. Include Windows logon domain.
c. Prompt for phone number.
then click Ok button.

The trouble I see here is that it still involves clicking.
This may not be your dream solution, but for those parts, you could create a short AutoHotkey script (or for the whole process, for that matter).

清泪尽 2025-01-01 18:18:33

看一下 rasdial ,它可以创建基于您提供的参数的拨号连接。

Take a look at rasdial which can create a dial-up connection based upon the arguments you provide.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文