run file with variable and spaces in variable

Author Message
jimbeam128

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 11/24/2011
  • Status: offline
run file with variable and spaces in variable Thursday, November 24, 2011 4:18 AM (permalink)
0
Hello,
 
I would like to execute a file on a server. The path to the file contains spaces. It´s not possible for me to change the folderstructure... - When I put the whole path and filename with quotations in the shell.run method it works, but I would like to use variables for that and other cases. Here my construct and what I tried:
 
When I use
shell.run """\\server\Software\Internet Explorer\IE8" & "\IE8-WindowsXP-x86-DEU.exe""", 0, True
it works. File will be executed.
 
I would like to have something like the following:
 
parta = "\\server\Software\Internet Explorer\IE8"
partb = "\IE8-WindowsXP-x86-DEU.exe"
 
shell.run ""parta" & ""partb"", 0, True
 
And this does not work... Could anybody be so kind and tell me what I´m doing wrong and how I can get it to work? Is it possible to do it in that way?
 
Thanks for your help!
 
 
#1
    ehvbs

    • Total Posts : 3321
    • Scores: 110
    • Reward points : 0
    • Joined: 6/22/2005
    • Location: Germany
    • Status: offline
    Re:run file with variable and spaces in variable Thursday, November 24, 2011 4:52 AM (permalink)
    0
    First read
    http://www.visualbasicscript.com/fb.ashx?m=81189
    Then establish the a reusable code fraqment for using .Run or .Exec
    Dim sCmd : sCmd = ...to be filled...
    WScript.Echo sCmd
    .Run sCmd, 0, True
    Then combine Quotes + parta + partb + Quotes, e.g.
    sCmd = """" & parta & partb & """"
     
    #2
      jimbeam128

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 11/24/2011
      • Status: offline
      Re:run file with variable and spaces in variable Thursday, November 24, 2011 8:09 PM (permalink)
      0
      Hello again,
       
      thanks for your help!
      The following did the trick right now for me:
       
      shell.run """" & parta & partb & """", 0, true
       
      where variable parta contains a path with spaces.
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9