中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-24 19:24
47,812 topics / 349,917 posts / today 0 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » Does batch processing have this function? Send the local machine's IP to a specified email
Printable Version  2,725 / 25
Floor16 nblue Posted 2006-06-12 19:13
初级用户 Posts 37 Credits 117
9th floor
>>1. What is VBS?
Floor17 zfbuild Posted 2006-06-13 16:16
新手上路 Posts 4 Credits 8
c:\1.vbs(15, 1) CDO.Message.1: Requires at least one recipient, but no recipients were found.
Error occurred
Floor18 nblue Posted 2006-06-13 17:15
初级用户 Posts 37 Credits 117
@echo off
for /f "tokens=2 delims=:" %%i in ('"ipconfig|findstr /I /c:"ip address""') do set a=%%i

echo NameSpace="http://schemas.microsoft.com/cdo/configuration/"
echo Set Email=CreateObject("CDO.Message")
echo Email.From="redf555@163.com"
echo Email.To="redf555@163.com"
echo Email.Subject="TEST"
echo Email.Textbody="%a%"
echo With Email.Configuration.Fields
echo ^.Item(NameSpace^&"sendusing")=2
echo ^.Item(NameSpace^&"smtpserver")="smtp.163.com"
echo ^.Item(NameSpace^&"smtpserverport")=25
echo ^.Item(NameSpace^&"smtpauthenticate")=1
echo ^.Item(NameSpace^&"sendusername")="redf555"
echo ^.Item(NameSpace^&"sendpassword")="123456"
echo ^.Update
echo End With
echo Email.Send

cscript c:\1.vbs
del c:\1.vbs

I got an error when I directly clicked it under XP:
Title: WINDOWS Script Host
Content:
Script: C:\1.VBS
Line: 1
Character: 1
Error: Invalid character
Code: 800A0408
Source: MICROSOFT VBSCRIPT compilation error
Floor19 bagpipe Posted 2006-06-13 17:29
银牌会员 Posts 425 Credits 1,144 From 北京
Oh my goodness, I had the CDO.MESSAGE object in 2000, but yours doesn't. Also, the person above, please check carefully before replying. Is your code correct? Alas.................. This time I'm really crying, it's because I'm angry...........
Floor20 Climbing Posted 2006-06-13 19:49
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
Hehe ha, encountered a DOS novice.
Floor21 nblue Posted 2006-06-14 08:54
初级用户 Posts 37 Credits 117
Originally posted by bagpipe at 2006-6-13 17:29:
Oh my god, I already had the CDO.MESSAGE object in 2000, but you don't have it. Also, the person above, please be careful when replying. Is your code correct? Alas................ This time I'm really crying, I was made to cry..

I'm sorry, my foundation in this area is really poor. If it weren't for the need for this function, I think I wouldn't even know these things. Please explain it clearly, okay? Maybe you've already explained it very clearly, but it still feels very advanced to a newbie like me.
Floor22 nblue Posted 2006-06-14 16:23
初级用户 Posts 37 Credits 117
Originally posted by bagpipe at 2006-6-13 17:29:
Oh my god, I had the CDO.MESSAGE object in 2000, but you don't have it. Also, the person above, please read carefully before replying. Is your code correct? Alas... I'm really crying this time, I was made to cry..

Hehe, made a fool of myself, please forgive me.
Now I finally got it done. To figure it out, I specifically went through the batch script and only then did I realize that DOS also has commands like > >>. Learned something new! Now it's been tested successfully!
Thanks everyone!
But I found that in the internal network, only the internal IP can be sent, and the external IP cannot be found
Floor23 shuaigeya Posted 2007-03-10 04:33
初级用户 Posts 19 Credits 42
Frustrated. Read so many posts, got a headache, still didn't understand a few.
Floor24 qq82015930 Posted 2007-03-12 07:20
中级用户 Posts 109 Credits 235
Didn't understand it.
Floor25 happygogo Posted 2007-03-13 05:32
新手上路 Posts 5 Credits 10
Is it not using a pure bat?
Floor26 yishanju Posted 2007-03-13 05:42
银牌会员 Posts 1,357 Credits 1,488
Oh, I often find this kind of problem. It's basically something that batch processing does. Sweat
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023