bat编程问题

来源:百度知道 编辑:UC知道 时间:2024/06/06 17:55:51
效果如下:
运行完一段程序后,屏幕上出现一句话:是否重启电脑(y/n)?
输入y重启电脑,输入n退出当前程序
如果没办法编程的话,效果和这个差不多的也行
帮我写个.exe程序也行,就是点击.exe程序,让他运行*.bat

写个C语言程序,include stdlib.h
然后system调用bat就可以了!
如果还不行,就看这个转换bat2exe
http://www.crsky.com/soft/6632.html

test.bat
-----------
@echo off

choice /c YN /m Are you Reboot computer?
if errorlevel 1 goto reboot:
if errorlevel 2 goto exit:
:reboot
call reboot
:exit
echo bye

-----------
演示需要文件:
1.choice.exe(这个你自己找好了!
2.reboot.com(这个你自己找好了!)
英文如果足够好,这里有本batfiles的handbook,保证够用了!!
http://home7.inet.tele.dk/batfiles/batfiles.htm

批处理你去找个dos高手问问

:::::保存并运行
@echo off
set /p com=是否重启电脑(y/n)?
if %com% EQU y goto restart
if %com% EQU n goto end
if %com% NEQ y goto end
:restart
shutdown -r -t 1
goto end

:end
exit

@echo off
:star