由于VM虛擬機(jī)的網(wǎng)絡(luò)連接造成服務(wù)器不能正常啟動(dòng),所以把網(wǎng)絡(luò)連接禁用了.但每次使用VM步驟會(huì)很繁瑣.所以做了個(gè)批處理.
啟動(dòng):
p>:啟動(dòng),打印命令
@echo on
net start vmnetdhcp
net start "VMware NAT Service"
:啟用網(wǎng)絡(luò)連接
netsh interface set interface name="VMware Network Adapter VMnet1" admin=ENABLED
netsh interface set interface name="VMware Network Adapter VMnet8" admin=ENABLED
:啟動(dòng)程序
"D:/Program Files/VMware/vmware.exe"
:暫停
pause
/p>
p>:啟動(dòng),打印命令
@echo on
net start vmnetdhcp
net start "VMware NAT Service"
:啟用網(wǎng)絡(luò)連接
netsh interface set interface name="VMware Network Adapter VMnet1" admin=ENABLED
netsh interface set interface name="VMware Network Adapter VMnet8" admin=ENABLED
:啟動(dòng)程序
"D:/Program Files/VMware/vmware.exe"
:暫停
pause
/p>
停止
p>:停止服務(wù)
@echo on
net stop vmnetdhcp
net stop "VMware NAT Service"
:禁用網(wǎng)絡(luò)連接
netsh interface set interface name="VMware Network Adapter VMnet1" admin=DISABLED
netsh interface set interface name="VMware Network Adapter VMnet8" admin=DISABLED
:強(qiáng)殺進(jìn)程
taskkill /F /im vmware-tray.exe
:暫停
pause
/p>
p>:停止服務(wù)
@echo on
net stop vmnetdhcp
net stop "VMware NAT Service"
:禁用網(wǎng)絡(luò)連接
netsh interface set interface name="VMware Network Adapter VMnet1" admin=DISABLED
netsh interface set interface name="VMware Network Adapter VMnet8" admin=DISABLED
:強(qiáng)殺進(jìn)程
taskkill /F /im vmware-tray.exe
:暫停
pause
/p>
以下是更加方便的
安裝VM后發(fā)現(xiàn)默認(rèn)服務(wù)是啟動(dòng)的,但并不是每次動(dòng)用到VM,為了優(yōu)化系統(tǒng),可以考慮按需啟動(dòng)服務(wù),但每次手工啟動(dòng)好幾個(gè)相關(guān)的服務(wù)的確比較麻煩。可以考慮采用批處理的方式來(lái)解決啟動(dòng)、停止的問(wèn)題:
@ echo off
title vmware服務(wù)開(kāi)啟、關(guān)閉程序
set in=set /p in=1.開(kāi)啟vm服務(wù),2.關(guān)閉vm服務(wù)。請(qǐng)輸入:
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 = 啟動(dòng)= 1 關(guān)閉= 2 設(shè)置手動(dòng)= 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 "正在啟動(dòng)VMware相關(guān)開(kāi)機(jī)服務(wù)..."
net start VMAuthdService
net start VMnetDHCP
net start "VMware NAT Service"
net start VMUSBArbService
echo 服務(wù)啟動(dòng)完畢!
ping 127.0.0.1 /n 2 >nul
goto:A/p>
p>:2
echo "正在關(guān)閉VMware相關(guān)開(kāi)機(jī)服務(wù)..."
net stop VMAuthdService
net stop VMnetDHCP
net stop "VMware NAT Service"
net stop VMUSBArbService
echo 服務(wù)已關(guān)閉!
ping 127.0.0.1 /n 2 >nul
goto:A/p>
p>:3
echo 切換VMware開(kāi)機(jī)啟動(dòng)服務(wù)為手動(dòng)中,請(qǐng)稍候...
sc config VMAuthdService start= demand
sc config VMnetDHCP start= demand
sc config "VMware NAT Service" start= demand
sc config VMUSBArbService start= demand
echo 成功切換為手動(dòng)模式!
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之后,開(kāi)機(jī)時(shí)按一下用戶(hù)名才能登錄桌面的解決方法:
1運(yùn)行框中輸入netplwiz
2取消 "要使用本機(jī),用戶(hù)必須輸入用戶(hù)名和密碼" 前面的勾