其他分享
首页 > 其他分享> > vbs中获取脚本当前路径的3个方法

vbs中获取脚本当前路径的3个方法

作者:互联网

方法一:

currentpath = createobject("Scripting.FileSystemObject").GetFolder(".").Path


方法二:

currentpath = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path

 

方法三:

msgbox "当前文件路径是 " & wscript.ScriptFullName 
set ws=CreateObject("WScript.Shell") 
MsgBox "当前文件夹是 " & ws.CurrentDirectory 

 

出处:http://www.hechaku.com/arcitle/20187224.html

https://www.cnblogs.com/dreamer-fish/p/14004033.html

=======================================================================================

WScript Object

 

Provides access to root object for the Windows Script Host object model.

Remarks

RootObjectWScript graphic

The WScript object is the root object of the Windows Script Host object model hierarchy. It never needs to be instantiated before invoking its properties and methods, and it is always available from any script file. The WScript object provides access to information such as:

The WScript object allows you to:

The WScript object can be used to set the mode in which the script runs (either interactive or batch).

Legacy Code Example

Since the WScript object is the root object for the Windows Script Host object model, many properties and methods apply to the object. For examples of specific syntax, visit the properties and methods links.

Properties

Arguments Property | BuildVersion Property | FullName Property (WScript Object) | Interactive Property | Name Property | Path Property | ScriptFullName Property | ScriptName Property | StdErr Property | StdIn Property | StdOut Property | Version Property

Methods

ConnectObject Method | CreateObject Method | DisconnectObject Method | Echo Method | GetObject Method | Quit Method | Sleep Method

See Also

WshShell Object
WshNetwork Object

 

 

出处:https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/windows-scripting/at5ydy31(v=vs.84)

 

标签:脚本,object,script,Windows,WScript,路径,vbs,Property,Method
来源: https://www.cnblogs.com/mq0036/p/15934439.html