Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Variable in the Run Method - I would sure like to be able to do this !

Status
Not open for further replies.

EdScripts

Programmer
May 20, 2023
1
US
Here is my program. My comments tell the Story,

Dim Sexy,WshShell3,fil

Set WshShell3 = WScript.CreateObject("WScript.Shell")
' I created a barebones script Here to Illustrate my failure at being able to use the Run method to run a variable
'I need to be able to use a variable in a much more complex script.

'WshShell3.Run """.\Src and Dst.txt"""
'Above Line Works

fil = ".\Src and Dst.txt"
Sexy = chr(34)+chr(34)+chr(34) + fil +chr(34)+chr(34)+chr(34)
'Sexy = chr(34)&chr(34)&chr(34) &fil &chr(34)&chr(34)&chr(34)
' Above Line has the Same Issue referenced below
Wscript.Echo Sexy
WshShell3.Run Sexy
'Above line Opens up This PC Explorer Window
Set WshShell3 = Nothing
Wscript.Quit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top