批处理,我可以从批处理脚本中打开网址吗? [英] Batch, Can I open a url from a batch script?

查看:73
本文介绍了批处理,我可以从批处理脚本中打开网址吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将告诉您我所要解决的问题,

I'll show you what I have then try to explain the question,

@echo off

Echo put search in front of a question to search for the answer on the internet

Set /p question=

到目前为止,如果用户将搜索放在搜索互联网的问题的前面,我希望它也位于一个批处理文件中.谢谢

That's it so far, if the user puts search I front of a question it searches the Internet, I would like it so it is in one batch file as well. Thanks

推荐答案

如果只想打开默认的Web浏览器,就像使用start一样简单.

If you just want to open the default web browser, it's as simple as using start.

此代码段将替换"search:"并与原始变量进行比较,以检查您的问题变量是否包含"search:".如果它们匹配,则没有输入搜索.

This snippet will check to see if your question variable contains "search:" by replacing "search:" and comparing against the original. If they match, search wasn't entered.

@setlocal enableextensions enabledelayedexpansion

set /p question=
set questionWOspaces=%question: =+%
IF NOT "%question:search:=%"=="%question%" (START http://www.google.com/search?q="%questionWOspaces:search:=%")

这篇关于批处理,我可以从批处理脚本中打开网址吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆