亲宝软件园·资讯

展开

设置VMWare虚拟机以及网络开关批处理

人气:0

由于VM虚拟机的网络连接造成服务器不能正常启动,所以把网络连接禁用了.但每次使用VM步骤会很繁琐.所以做了个批处理.

启动:

<p>:启动,打印命令
@echo on
net start vmnetdhcp
net start "VMware NAT Service"
:启用网络连接
netsh interface set interface name="VMware Network Adapter VMnet1" admin=ENABLED
netsh interface set interface name="VMware Network Adapter VMnet8" admin=ENABLED
:启动程序
"D:/Program Files/VMware/vmware.exe"
:暂停
pause
</p>

 

<p>:启动,打印命令
@echo on
net start vmnetdhcp
net start "VMware NAT Service"
:启用网络连接
netsh interface set interface name="VMware Network Adapter VMnet1" admin=ENABLED
netsh interface set interface name="VMware Network Adapter VMnet8" admin=ENABLED
:启动程序
"D:/Program Files/VMware/vmware.exe"
:暂停
pause
</p>

停止

<p>:停止服务
@echo on
net stop vmnetdhcp
net stop "VMware NAT Service"
:禁用网络连接
netsh interface set interface name="VMware Network Adapter VMnet1" admin=DISABLED
netsh interface set interface name="VMware Network Adapter VMnet8" admin=DISABLED
:强杀进程
taskkill /F /im vmware-tray.exe
:暂停
pause
</p>


 

<p>:停止服务
@echo on
net stop vmnetdhcp
net stop "VMware NAT Service"
:禁用网络连接
netsh interface set interface name="VMware Network Adapter VMnet1" admin=DISABLED
netsh interface set interface name="VMware Network Adapter VMnet8" admin=DISABLED
:强杀进程
taskkill /F /im vmware-tray.exe
:暂停
pause
</p>

以下是更加方便的

安装VM后发现默认服务是启动的,但并不是每次动用到VM,为了优化系统,可以考虑按需启动服务,但每次手工启动好几个相关的服务的确比较麻烦。可以考虑采用批处理的方式来解决启动、停止的问题:

@ echo off
title vmware服务开启、关闭程序
set in=set /p in=1.开启vm服务,2.关闭vm服务。请输入:

if "%in%"=="1" goto start
if "%in%"=="2" goto stop
exit
:start
net start ufad-ws60
net start VMAuthdService
net start VMnetDHCP
net start "VMware NAT Service"
net start VMUSBArbServicepause
exit
:stop
net stop ufad-ws60
net stop VMAuthdService
net stop VMnetDHCP
net stop "VMware NAT Service"
net stop VMUSBArbService
pause
exit

或者如下:

echo off
title Switch %date% %time%
:A
color A
cls
echo ++++++++++++++++++++++++++++++++++++++++++++++++
echo = WELCOME TO VMware SWITCH =
echo. = =
echo = 启动= 1 关闭= 2 设置手动= 3 退出= 4 =
echo. = =
echo. = =
echo ++++++++++++++++++++++++++++++++++++++++++++++++
echo.
echo.
set session=""
set /p session= Select[1/2/3/4]:
if /i "%session%"=="1" (goto:1)
if /i "%session%"=="2" (goto:2)
if /i "%session%"=="3" (goto:3)
if /i "%session%"=="4" (goto:4)</p> <p>:1
echo "正在启动VMware相关开机服务..."
net start VMAuthdService
net start VMnetDHCP
net start "VMware NAT Service"
net start VMUSBArbService
echo 服务启动完毕!
ping 127.0.0.1 /n 2 >nul
goto:A</p> <p>:2
echo "正在关闭VMware相关开机服务..."
net stop VMAuthdService
net stop VMnetDHCP
net stop "VMware NAT Service"
net stop VMUSBArbService
echo 服务已关闭!
ping 127.0.0.1 /n 2 >nul
goto:A</p> <p>:3
echo 切换VMware开机启动服务为手动中,请稍候...
sc config VMAuthdService start= demand
sc config VMnetDHCP start= demand
sc config "VMware NAT Service" start= demand
sc config VMUSBArbService start= demand
echo 成功切换为手动模式!
ping 127.0.0.1 /n 2 >nul
goto:A</p> <p>:4
cls
echo 谢谢使用...
ping 127.0.0.1 /n 2 >nul
exit

另外,如果安装VM之后,开机时按一下用户名才能登录桌面的解决方法:
1运行框中输入netplwiz   
2取消 "要使用本机,用户必须输入用户名和密码"  前面的勾

加载全部内容

相关教程
猜你喜欢
用户评论