How to insert my SCRIPT_PATH
Variable into PowerShell script path? Also anyone know any Visual Studio Like tool I can write those? I think Visual Studio uses different .net vbs.
Here is the code:
SCRIPT_PATH = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - (Len(WScript.ScriptName)))
MsgBox SCRIPT_PATH
Set objShell = CreateObject("WScript.Shell")
objShell.Run "RUNAS /user:DomainUser ""powershell SCRIPT_PATH & Delete_App_Script.ps1"""
Set objShell = Nothing
How do I do SCRIPT_PATH = SCRIPT_PATH + Delete_App_Script.ps1
?
SCRIPT_PATH = SCRIPT_PATH & "Delete_App_Script.ps1"
doesn't work.
It gives no errors, so I am not sure what is the problem.
Am I missing some ""
or some ,,
?
I've seen some .Run ,,,
syntax for Admin running and this one, doesn't explain what goes into ""
.
Not looking forward creating interface for this.
This doesn't work:
Set objShell = CreateObject("WScript.Shell")
SCRIPT_PATH = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - (Len(WScript.ScriptName)))
SCRIPT_PATH = SCRIPT_PATH & "Delete_App_Script.ps1"
objShell.Run "RUNAS /user:Domadm ""powershell SCRIPT_PATH"""
Set objShell = Nothing
But this works:
Set objShell = CreateObject("WScript.Shell")
objShell.Run "RUNAS /user:Domadm ""powershell C:Delete_App_Script.ps1"""
Set objShell = Nothing
What am I missing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…