还没有弄清楚如何把一行和更新
michael_heath
有点我的代码:
@echo on
setlocal
CHOICE /C ectfx /m "e do everything, c clip only, t taskkill only, f skip this, x close this"
If errorlevel 5 EXIT /B
If errorlevel 4 goto :choiceff
If errorlevel 3 call :taskkillonly
If errorlevel 2 call :cliponly
If errorlevel 1 call :everything
:choiceff
CHOICE /C wtx /m "w open new window, t open new tab, x close this"
If errorlevel 3 EXIT /B
If errorlevel 2 call :newtab
If errorlevel 1 call :newwindow
EXIT /B
:cliponly
echo|set /p=username@email.com|clip
EXIT /B
:taskkillonly
TASKKILL /F /T^
/IM Greenshot.exe^
/IM iprntctl.exe^
/IM iprntlgn.exe^
/IM smax4pnp.exe^
/IM ZenNotifyIcon.exe^
/IM ZenUserDaemon.exe^
/IM RAVBg64.exe^
/IM nwtray.exe^
/IM RtkNGUI64.exe^
/IM BingSvc.exe^
/IM Spotify.exe^
/IM SpotifyWebHelper.exe^
/IM FacebookGameroom.exe^
/IM "Facebook Gameroom Browser.exe"^
/IM zapp.exe^
/IM steamwebhelper.exe^
/IM Steam.exe^
/IM lync.exe
EXIT /B
:everything
echo|set /p=username@email.com|clip
TASKKILL /F /T^
/IM Greenshot.exe^
/IM iprntctl.exe^
/IM iprntlgn.exe^
/IM smax4pnp.exe^
/IM ZenNotifyIcon.exe^
/IM ZenUserDaemon.exe^
/IM RAVBg64.exe^
/IM nwtray.exe^
/IM RtkNGUI64.exe^
/IM BingSvc.exe^
/IM Spotify.exe^
/IM SpotifyWebHelper.exe^
/IM FacebookGameroom.exe^
/IM "Facebook Gameroom Browser.exe"^
/IM zapp.exe^
/IM steamwebhelper.exe^
/IM Steam.exe^
/IM lync.exe
EXIT /B
:newwindow
CD /D "C:\Program Files (x86)\Mozilla Firefox"
firefox.exe^
"https://www.outlook.com/"^
"http://everybodyedits.com/"^
"http://www.kongregate.com/accounts/username/recently-played"
EXIT /B
:newtab
CD /D "C:\Program Files (x86)\Mozilla Firefox"
firefox.exe^
-new-tab "https://www.outlook.com/"^
-new-tab "http://everybodyedits.com/"^
-new-tab "http://www.kongregate.com/accounts/username/recently-played"
EXIT /B
删除VAR
cliportaskkill
和
startffox
从代码和一个小bug中,只有在完成代码后才按t键终止taskkill,它会进入下一个错误级别并调用
:cliponly
代码,然后再转到下一个choice命令(在这里,我将
& goto :label
以停止此错误,但在放入一行时可能会破坏此BAT文件。)
P、 S。
在不久的将来,我想我可以把
cliportaskkill
和
StartFox公司
VAR返回,以便我可以将其用于并行代码或两个实例,而无需等待其他代码完成(也无需在另一个BAT文件中完成)
I'ev将echo设置为on,此处显示代码的输出。
>setlocal
>CHOICE /C ectfx /m "e do everything, c clip only, t taskkill only, f skip this, x close this"
e do everything, c clip only, t taskkill only, f skip this, x close this [E,C,T,F,X]?T
>If errorlevel 5 EXIT /B
>If errorlevel 4 goto :choiceff
>If errorlevel 3 call :taskkillonly
>TASKKILL /F /T /IM Greenshot.exe /IM iprntctl.exe /IM iprntlgn.exe /IM smax4pnp.exe /IM ZenNotifyIcon.ex
e /IM ZenUserDaemon.exe /IM RAVBg64.exe /IM nwtray.exe /IM RtkNGUI64.exe /IM BingSvc.exe /IM Spotify.exe /IM SpotifyWebHelper.exe /IM F
acebookGameroom.exe /IM "Facebook Gameroom Browser.exe" /IM zapp.exe /IM steamwebhelper.exe /IM Steam.exe /IM lync.exe
ERROR: The process "Greenshot.exe" not found.
ERROR: The process "iprntctl.exe" not found.
ERROR: The process "iprntlgn.exe" not found.
ERROR: The process "smax4pnp.exe" not found.
ERROR: The process "ZenNotifyIcon.exe" not found.
ERROR: The process "ZenUserDaemon.exe" not found.
ERROR: The process "RAVBg64.exe" not found.
ERROR: The process "nwtray.exe" not found.
ERROR: The process "RtkNGUI64.exe" not found.
ERROR: The process "BingSvc.exe" not found.
ERROR: The process "Spotify.exe" not found.
ERROR: The process "SpotifyWebHelper.exe" not found.
ERROR: The process "FacebookGameroom.exe" not found.
ERROR: The process "Facebook Gameroom Browser.exe" not found.
ERROR: The process "zapp.exe" not found.
ERROR: The process "steamwebhelper.exe" not found.
ERROR: The process "Steam.exe" not found.
ERROR: The process "lync.exe" not found.
>EXIT /B
>If errorlevel 2 call :cliponly
>echo | set /p=username@email.com | clip
>EXIT /B
>If errorlevel 1 call :everything
>CHOICE /C wtx /m "w open new window, t open new tab, x close this"
w open new window, t open new tab, x close this [W,T,X]?
正如您在taskkill块之后看到的,它转到下一个块,即转到下一个块之前的片段代码
CHOICE
commmand(由于某些原因,它不会转到下一个代码块。)
我已经按了T键
>If errorlevel 3 EXIT /B
>If errorlevel 2 call :newtab
>CD /D "C:\Program Files (x86)\Mozilla Firefox"
>firefox.exe -new-tab "https://www.outlook.com/" -new-tab "http://everybodyedits.com/" -new-tab "
http://www.kongregate.com/accounts/username/recently-played"
>ECHO newtab!
newtab!
>pause
Press any key to continue . . .
>EXIT /B
>If errorlevel 1 call :newwindow
>CD /D "C:\Program Files (x86)\Mozilla Firefox"
>firefox.exe "https://www.outlook.com/" "http://everybodyedits.com/" "http://www.kongregate.com/a
ccounts/username/recently-played"
>ECHO newwindow!
newwindow!
>pause
Press any key to continue . . .
我添加了一个
echo
和
pause
测试它是否对此执行相同操作
选择
命令,并在完成上一个代码后启动下一个代码块。我已经在一个测试文件中对此进行了测试,其中使用了一些选项,如errorlevel、calling和goto命令以及测试文件中发生的相同错误。