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

如何从命令行创建windows拨号连接,windows,command-line,dial-up,Windows,Command Line,Dial Up,如何从命令行在windows上创建拨号连接 “创建”不是指如何建立现有连接,而是指如何创建新的拨号连接。常用的方法是使用新连接向导(GUI),但我想从命令行(脚本)创建(和删除)连接 我只想在需要时创建拨号连接,因为如果没有可用的internet连接,windows会弹出一个对话框,要求使用拨号连接进行连接,这会阻止请求连接的程序。如果拨号连接不存在,则不会发生这种情况。禁用拨号连接上的“默认连接”设置并不会阻止弹出对话框。查看哪些选项可以根据您提供的参数创建拨号连接。您是否看到Microsof

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

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


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

查看哪些选项可以根据您提供的参数创建拨号连接。

您是否看到Microsoft自己的页面,介绍如何使用rasphone.exe设置(创建)拨号连接

如何通过rasphone.exe命令设置拨号连接
单击开始,在开始搜索框中键入rasphone-a,然后按Enter键。
单击“如何连接”页面上的“拨号”按钮。
键入电话号码和目的地名称(如拨号),在“键入要连接的电话号码”页面上,单击“下一步”按钮继续。
键入用户名和密码,并确保已选中“记住此密码”复选框,在“键入用户名和密码”页面上,单击“创建”按钮继续。
单击开始,在开始搜索框中键入rasphone-e,然后按Enter键。
注意:您必须使用在步骤3中键入的目标名称,例如拨号。
在拨号属性的选项标签上,清除以下选项:
A.提示输入名称、密码、证书等。
B包括Windows登录域。
C提示输入电话号码。
然后单击Ok按钮。
我在这里看到的问题是,它仍然需要点击。
这可能不是您理想的解决方案,但对于这些部分,您可以创建一个简短的脚本(或整个过程)。

谢谢,但Rasdail无法创建新的拨号连接。使用rasdial,您可以建立(或关闭)现有的拨号连接,并可以选择提供新的电话号码或用户凭据,但不可能创建新的拨号连接。至于您的第二段,我特别记得只有在“控制面板”的“Internet设置”中才提供“从不拨号连接”选项,或IE的右键单击菜单。无法从拨号网络连接设置窗口或调制解调器属性访问它。例如:
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.