Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Cannot run string in oShell.Run

$
0
0

Hello,

I have a script which has to call 32 bits objects (starting SCCM actions).

I created a main vbs script and a secondary script containing the 32 bits objects, called StartCMPolicies.vbs

In the main script I can easily call the second script:

oShell.Run("C:\Windows\SysWOW64\cmd /k cscript C:\Users\alexandru.cojocaru\Desktop\StartCMPolicies.vbs")

The problem is that I want to run this on any computer so I have to use %userprofile% instead of my name. I just can't make it work. If I try something like:

userProfilePath = oShell.ExpandEnvironmentStrings("%UserProfile%")

str = " " & userProfilePath & "\Desktop\StartCMPolicies.vbs"

oShell.Run("C:\Windows\SysWOW64\cmd /k cscript & str")

... it will take literally the & str characters instead of the path behind. I can't put "str" either. I think it's something simple that I can't see. Could you please help me with that.

Thanks, Alex


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>