VBScript kullanıyorum ve hedefim seçtiğim bir yol için bir sürücü harfinin yerini alabilmektir. D sürücüsüne ihtiyacım var ve eğer uygun değilse, zaten doğru noktaya eşlenmiş olup olmadığını kontrol etmem gerekiyor; sonra değilse kullanıcıyı bilgilendirin. Bu bulundu: http://technet.microsoft.com/en-us/library/ee156605.aspx ve onların ikinci örnek adapte etmeye çalışıyorum:VBScript'te komut satırı çıkışı alınıyor (dosyalara yazmadan)
Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("cmd /c ping -n 3 -w 1000 157.59.0.1")
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadLine()
If Instr(strText, "Reply") > 0 Then
Wscript.Echo "Reply received."
Exit Do
End If
Loop
(my uyarlamalar):
Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("cmd /c substr")
strText = ""
Do While Not objExecObject.StdOut.AtEndOfStream
strText = strText & objExecObject.StdOut.ReadLine()
Loop
Wscript.Echo strText
Sonra muhtemelen burada D sürücüsünü söyler dize için arama edeceğiz haritalanmış. Ben de objShell.Exec("subst")
denedim, ama hala herhangi bir çıkış almıyorum. Yanlış yapabileceklerim hakkında herhangi bir fikri olan var mı? Veya sürücü eşlemeleri hakkında daha iyi bir yol var mı? Teşekkürler,
vay, bu ... birkaç gün için eksik oldukça şey teşekkürler – 213897