由于VM虛擬機的網(wǎng)絡連接造成服務器不能正常啟動,所以把網(wǎng)絡連接禁用了.但每次使用VM步驟會很繁瑣.所以做了個批處理.
啟動:
p>:啟動,打印命令
@echo on
net start vmnetdhcp
net start "VMware NAT Service"
:啟用網(wǎng)絡連接
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"
:啟用網(wǎng)絡連接
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"
:禁用網(wǎng)絡連接
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"
:禁用網(wǎng)絡連接
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后發(fā)現(xiàn)默認服務是啟動的,但并不是每次動用到VM,為了優(yōu)化系統(tǒng),可以考慮按需啟動服務,但每次手工啟動好幾個相關(guān)的服務的確比較麻煩??梢钥紤]采用批處理的方式來解決啟動、停止的問題:
@ echo off
title vmware服務開啟、關(guān)閉程序
set in=set /p in=1.開啟vm服務,2.關(guān)閉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 關(guān)閉= 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相關(guān)開機服務..."
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 "正在關(guān)閉VMware相關(guān)開機服務..."
net stop VMAuthdService
net stop VMnetDHCP
net stop "VMware NAT Service"
net stop VMUSBArbService
echo 服務已關(guān)閉!
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取消 "要使用本機,用戶必須輸入用戶名和密碼" 前面的勾