2015-05-09 87 views
0

我會告訴你我已再試圖解釋的問題,批處理,我可以從批處理腳本中打開url嗎?

@echo off 

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

Set /p question= 

就是這樣,到目前爲止,如果用戶將它在網上搜索問題的搜索我的面前,我想它,所以它也在一個批處理文件中。由於

+0

可能重複[如何使用批處理腳本和關鍵字搜索Internet?](http://stackoverflow.com/questions/30135897/how-do-you-search-the-internet-與-A-批處理腳本和一個關鍵字) – rojo

回答

1

如果你只是想打開默認的Web瀏覽器,這是因爲使用start一樣簡單。

這段代碼將檢查您的問題變量是否包含「search:」,方法是替換「search:」並與原始值進行比較。如果它們匹配,則不會輸入搜索。

@setlocal enableextensions enabledelayedexpansion 

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