简体   繁体   English

在VBScript中调用PowerShell脚本

[英]Call PowerShell script in VBScript

Hi can someone pls help me to run powershell from vbscript as a administrator 嗨,有人请帮助我作为管理员从vbscript运行powershell

VB Script VB脚本

MyPath = "c:\\temp\\folder1" Dim objShell Set objShell = CreateObject("Wscript.Shell") objShell.run("powershell.exe -noexit -file C:\\temp\\power.ps1 " & MyPath) MyPath =“c:\\ temp \\ folder1”Dim objShell设置objShell = CreateObject(“Wscript.Shell”)objShell.run(“powershell.exe -noexit -file C:\\ temp \\ power.ps1”&MyPath)

PowerShell power.ps1 PowerShell power.ps1

C:\\temp\\psfile.exe $args[0] -c C:\\ temp \\ psfile.exe $ args [0] -c

In VBScript Set is used for objects; 在VBScript中Set用于对象; so change 所以改变

set input ="C:\temp\folder1\"

to

input = "C:\temp\folder1\"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM