Ajouter une variable à une autre
Bonsoir,
Je souhaiterai ajouter le contenu de var1 et var2 dans la variable lien.
Voici mon fichier bat :
Code:
1 2 3 4 5 6 7
| @echo Mot 1 :
@set /p var1=
@echo Mot 2 :
@set /p var2=
@set lien="https://www.google.fr/#q=" "%var1%" + "%var2%"
@echo %lien%
@pause |
Par exemple :
var1 = maison
var2 = porte
La variable lien sera donc lien=https://www.google.fr/#q=maison+porte
Malheureusement, ce n'est pas la bonne syntaxe. Avez vous une idée ? Merci !
[HTA] Recherche avec Google
:salut:
Voici un autre programme écrit en Vbscript et interfacé par un HTA :king:
Il faut juste copier et coller ce code dans votre notepad et enregistrez le sous le nom par exemple GoogleSearch.hta
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| <html>
<head>
<HTA:APPLICATION
APPLICATIONNAME="Recherche avec Google © Hackoo"
BORDER="THIN"
BORDERSTYLE="NORMAL"
ICON="magnify.exe"
INNERBORDER="NO"
MAXIMIZEBUTTON="NO"
MINIMIZEBUTTON="NO"
SCROLL="NO"
SELECTION="NO"
SYSMENU="YES"
SINGLEINSTANCE="YES"/>
<META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
<script language="VBScript">
Option Explicit
Dim Titre
Titre = "Recherche avec Google © Hackoo"
Self.document.title = Titre
Sub window_onload()
CALL CenterWindow(300,160)
Self.document.bgColor = "Orange"
End Sub
Sub RunProgram()
Dim X,Y,URL,objShell,Param,MaCmd
X = text1.value
Y = text2.value
Param = "#q="& X & "+" & Y &""
URL = "www.google.com"& Param
Set objShell = CreateObject("Wscript.Shell")
MaCmd = DblQuote(URL)
objShell.Run(MaCmd)
End Sub
'***************************************************
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'***************************************************
'Position Windows
Sub CenterWindow(x,y)
Dim iLeft,itop
window.resizeTo x,y
iLeft = window.screen.availWidth/2 - x/2
itop = window.screen.availHeight/2 - y/2
window.moveTo ileft, itop
End Sub
</script>
</head>
<body><center>
Text1 : <input type="text" id="text1" Name="text1" value="Vbscript"><br>
Text2 : <input type="text" id="text2" Name="text2" value="Hackoo"><br><br>
<input type="submit" Value="Recherche avec Google" onclick="RunProgram()"></center>
</body>
</html> |