求VB高手详解。 Set a = Createobject(”wscript.shell”)

dimaSeta=CreateObject(“wscript.shell”)这段代码是什么意思?其中shell、wscript是关于什么知识的?... dim a Set a = CreateObject(“wscript.shell”)这段代码是什么意思?其中shell、wscript是关于什么知识的? 展开
 我来答
ireray5
2011-12-02 · TA获得超过396个赞
知道小有建树答主
回答量:557
采纳率:0%
帮助的人:377万
展开全部
这段代码是vbscript脚本语言,执行windows脚本。
Set a = CreateObject(“wscript.shell”)
是生成windows外壳的一个实例。
下面是援引MS的技术文章片断,参考。
Welcome to the Windows Script Host Reference

This information will help you explore the many different parts of Windows Script Host.
Each part of the Windows Script Host language is listed alphabetically under the Alphabetic Keyword List. If you want to examine just one category, say, objects, just click on the objects heading, and you will only see Windows Script Host objects.

Click on a heading to the left to display a list of items contained in that category. From this list, select the topic that you want to view. Once you have opened a topic, you can easily link to other related sections.

Feel free to navigate through the various parts that make up Windows Script Host Language Reference, and see just how versatile the Windows Script Host language can be.

----------------------------------------
WScript Object
Exposes properties that provide the path of the running scripting host (WScript.exe or cscript.exe), its arguments, and the working mode (interactive or batch). The WScript object also provides methods to create and read objects.

Example
The following example demonstrates the use of a single .wsf file for two jobs in different script languages (VBScript and JScript). The functionality of both jobs is the same — each creates a shortcut to the script being run, and a URLShortcut to www.microsoft.com:

<package>

<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
oShellLink.TargetPath = WScript.ScriptFullName
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "CTRL+SHIFT+F"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = strDesktop
oShellLink.Save

set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Microsoft Web Site.url")
oUrlLink.TargetPath = "http://www.microsoft.com"
oUrlLink.Save
</script>
</job>

<job id="js">
<script language="Javascript">
var WshShell = new ActiveXObject("WScript.Shell");
strDesktop = WshShell.SpecialFolders("Desktop");
var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk");
oShellLink.TargetPath = WScript.ScriptFullName;
oShellLink.WindowStyle = 1;
oShellLink.Hotkey = "CTRL+SHIFT+F";
oShellLink.IconLocation = "notepad.exe, 0";
oShellLink.Description = "Shortcut Script";
oShellLink.WorkingDirectory = strDesktop;
oShellLink.Save();

var oUrlLink = WshShell.CreateShortcut(strDesktop + "\\Microsoft Web Site.url");
oUrlLink.TargetPath = "http://www.microsoft.com";
oUrlLink.Save();
</script>
</job>

</package>
zx001z7d53
2011-12-02 · TA获得超过2万个赞
知道大有可为答主
回答量:2.4万
采纳率:52%
帮助的人:6172万
展开全部
声明一个对象库,下一步就是使用这个库里面的函数
实际上这个库就是wshom.ocx文件
wscript是库的名字,shell是里面的一个对象
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式