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

Using command line from VBscript

$
0
0

So I'm trying to make function for a larger script to use the command line from a VBscript. I've worked out this script to attempt a basic command line function. Simply create a directory using a variable as the name. Except I can't seem to get the command line function to work with a variable, the script executes without error, but the directory is not made. 

This works:

Dim oshell 
Set oShell = WScript.CreateObject ("WScript.Shell") 

oShell.run "cmd.exe /C mkdir c:\rtlassets" 
Set oShell = Nothing 
But as soon as I try to use a variable:
Dim oshell 
Set oShell = WScript.CreateObject ("WScript.Shell") 
Dim ECHO 
ECHO = "mkdir c:\rtlassets"

oShell.run "cmd.exe /C & ECHO &"  
Set oShell = Nothing 
It stops working. Any idea what is wrong with the syntax?


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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