关于ping命令的bat文件怎么写

2024-11-24 05:24:44
推荐回答(3个)
回答1:

不能实现在显示的同时输出到文本。只能二选其一。

回答2:

ping IP

回答3:

不能将文件名保存为ping.bat,因为ping命令一般是电脑自带的程序,cmd运行时容易出错。以下步骤为windows7为例。
1、首先在电脑上新建一个文本文档,如图所示。
/iknow-pic.cdn.bcebos.com/64380cd7912397dd16e708265682b2b7d0a28772"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/64380cd7912397dd16e708265682b2b7d0a28772?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/64380cd7912397dd16e708265682b2b7d0a28772"/>
2、文档建好后,用鼠标左键双击打开此文件,如图所示。
/iknow-pic.cdn.bcebos.com/0e2442a7d933c895e7e70859de1373f082020072"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/0e2442a7d933c895e7e70859de1373f082020072?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/0e2442a7d933c895e7e70859de1373f082020072"/>
3、然后在文档编辑页面,输入“ping www.163.com”。
/iknow-pic.cdn.bcebos.com/3bf33a87e950352a6dffb52a5c43fbf2b2118b72"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/3bf33a87e950352a6dffb52a5c43fbf2b2118b72?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/3bf33a87e950352a6dffb52a5c43fbf2b2118b72"/>
4、然后在文件的下拉菜单中,点击“另存为”选项。
/iknow-pic.cdn.bcebos.com/55e736d12f2eb9384917edd0da628535e5dd6f9e"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/55e736d12f2eb9384917edd0da628535e5dd6f9e?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/55e736d12f2eb9384917edd0da628535e5dd6f9e"/>
5、然后在另存为窗口,将文件名为test.dat,保存类型设置为“所有文件”,进行保存。
/iknow-pic.cdn.bcebos.com/ae51f3deb48f8c5476a9520d35292df5e0fe7f9e"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/ae51f3deb48f8c5476a9520d35292df5e0fe7f9e?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/ae51f3deb48f8c5476a9520d35292df5e0fe7f9e"/>
6、接着用鼠标双击刚刚保存好的文件,如图所示。
/iknow-pic.cdn.bcebos.com/5bafa40f4bfbfbede9a6a15d77f0f736afc31f10"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/5bafa40f4bfbfbede9a6a15d77f0f736afc31f10?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/5bafa40f4bfbfbede9a6a15d77f0f736afc31f10"/>
7、完成以上设置后,ping命令就正常运行了。
/iknow-pic.cdn.bcebos.com/a5c27d1ed21b0ef438170f7cd2c451da81cb3e10"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/a5c27d1ed21b0ef438170f7cd2c451da81cb3e10?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/a5c27d1ed21b0ef438170f7cd2c451da81cb3e10"/>