Cov txheej txheem:

Yuav Ua Li Cas Ntxiv Cov Lus Qhia Hauv Cov Txheej Txheem Batch: 3 Kauj Ruam
Yuav Ua Li Cas Ntxiv Cov Lus Qhia Hauv Cov Txheej Txheem Batch: 3 Kauj Ruam

Video: Yuav Ua Li Cas Ntxiv Cov Lus Qhia Hauv Cov Txheej Txheem Batch: 3 Kauj Ruam

Video: Yuav Ua Li Cas Ntxiv Cov Lus Qhia Hauv Cov Txheej Txheem Batch: 3 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Ntxiv Cov Lus Qhia Hauv Batch Programming
Yuav Ua Li Cas Ntxiv Cov Lus Qhia Hauv Batch Programming

Koj puas tau xav ntxiv cov duab sib dhos rau koj cov ntaub ntawv ib yam li koj tuaj yeem ua hauv VBScript? Kuv paub tseeb tias muaj. Tab sis tam sim no koj tuaj yeem nrog txoj haujlwm zoo no hu ua MessageBox.

Kauj ruam 1: Kev teeb tsa

Koj tuaj yeem rub qhov program ntawm no ------ LINK

Tom qab koj tau rub tawm thiab rho tawm cov ntawv, txav cov ntawv hu ua MSGBOX. EXE rau koj li system32 nplaub tshev, feem ntau nws nyob hauv C: / windows / system32.

Kauj Ruam 2: Xeem

Tam sim no, qhib cmd thiab ntaus ntawv xov tooj thiab koj yuav tsum pom nws yog syntax. Koj kuj tseem tuaj yeem ua piv txwv.bat los sim nws ib yam. Yog li yog tias koj tsis nkag siab siv nws li cas, Kuv muaj qhov piv txwv hauv qab no:

Msgbox "Nyob zoo / n / n Koj puas xav txuas ntxiv?" "Nov yog Xov Xwm" YESNO

-

Yog li ua ntej "Nyob zoo / n / n Koj puas xav txuas ntxiv?". Nov yog lub cev lus. Qhov "\ n / n" yog tsheb thauj rov qab.

-

Qhov thib ob "Qhov no yog Xov Xwm". Nov yog Lub Npe Hauv Cov Lus Qhia.

-

Qhov thib peb "YESNO". Nov yog cov nyees khawm uas yuav qhia rau ntawm Lub Xov Tooj. Cov kev sib txuas hauv qab no yog:

YESNO, YESNOCANCEL, OKCANCEL thiab yog tias sab laug tom qab nws nws tsuas yog tso saib OK.

-

Yog li tam sim no koj paub tias MsgBox ua haujlwm li cas, tam sim no koj tuaj yeem ntxiv cov haujlwm thaum lub pob nyem.

Piv txwv hauv tsab ntawv batch:

@echo tawm

Msgbox "Nyob zoo / n / n Koj puas xav txuas ntxiv?" "Nov yog Ntawv Xov Xwm" YESNOCANCEL

yog %errorlevel %== 6 GOTO yog

yog %errorlevel %== 7 GOTO no

yog %errorlevel %== 2 GOTO rho tawm

:: OK yuav yog: yog %errorlevel %== 1 goto OK

: yog

echo Koj nyem Yog lawm

paus> NUL

tawm

: tsis muaj

echo Koj nyem Tsis tau

ncua> NULexit

: rho tawm

ncha Koj Nyem rau ntawm Ncua tseg

ncua> NULexit

Kauj ruam 3: Txaus siab rau

Tam sim no koj tuaj yeem txaus siab rau Txoj Haujlwm Xov Xwm!

Yog koj muaj lus nug lossis kev txhawj xeeb thov sau ntawv tawm tswv yim lossis PM rau kuv.

Pom zoo: