Bueno, en algunos scripts es necesario saber la ruta donde nuestro script se esta ejecutando, para realizar acciones adicionales en dicha ruta.
A continuación les dejo unos tips para averiguar las rutas de ejecución:
Full Path
- script:
WScript.ScriptFullName wscript.echo path = path
Sample Output: C: \\ Users \\ Desktop \\ path.vbs
- Directory Implementation:
- Option 1:
AbsPath = Replace (WScript.ScriptFullName, WScript.ScriptName, "") wscript.echo
abspath
Sample Output: C: \\ Users \\ Desktop \\
Option 2:
Set WshShell = CreateObject ("WScript.Shell") WScript.Echo
WshShell.CurrentDirectory
Sample Output: C: \\ Users \\ Desktop
Option 3:
Set fso = WScript.CreateObject ("Scripting.FileSystemObject") wscript.echo
fso.GetAbsolutePathName (".")
Sample Output: C: \\ Users \\ Desktop
0 comments:
Post a Comment