issue on scripting syntax on x64

Discussion in 'Scripting' started by Tyler Durden, Jun 8, 2009.

  1. Tyler Durden

    Tyler Durden Guest

    The following script runs normally on a x32 environment, and end without
    finding the exe on a x64. What could be the issue?

    Dim WSHShell
    Set WSHShell = CreateObject("WScript.Shell")
    WSHShell.CurrentDirectory = WScript.ScriptFullName & "\.."
    WSHShell.CurrentDirectory = WSHShell.CurrentDirectory & "\my_program_folder"
    WSHShell.Run "my_exe.exe /param1 /param2"

    Any help would be appreciated.
     
    Tyler Durden, Jun 8, 2009
    #1
    1. Advertisements

  2. Have you tried using a fully qualified path for your .exe file, instead of
    relying on a working directory that may or may not be correct?
     
    Pegasus [MVP], Jun 8, 2009
    #2
    1. Advertisements

  3. If you are certain the exe is in the specified subfolder of the folder where
    the VBScript is saved, perhaps something similar to this would work better:
    ===========
    Dim WSHShell, strCmd

    Set WSHShell = CreateObject("WScript.Shell")
    strCmd = "%comspec% /c """ & Wscript.ScriptFullName _
    & "\..\my_program_folder\my_exe.exe"" /param1 /param2"
    Wscript.Echo strCmd
    WSHShell.Run strCmd, 2
    ========
    The statement to echo strCmd is for troubleshooting, to make sure the
    command is correct. Note the path and file name are in quotes, and quotes in
    a quoted string must be doubled.
     
    Richard Mueller [MVP], Jun 8, 2009
    #3
  4. Tyler Durden

    Tyler Durden Guest

    full qualified path is not possible as the app is portable, so drive letter
    can change.
     
    Tyler Durden, Jun 10, 2009
    #4
  5. Tyler Durden

    Tyler Durden Guest

    on x32 still worked fine, could not test it on a x64 yet. would be possible
    to do it without cmd.exe?

    thank you!
     
    Tyler Durden, Jun 10, 2009
    #5
  6. I think most exe program will run fine without using %comspec% /c. In that
    case:

    strCmd = """" & Wscript.ScriptFullName _
    & "\..\my_program_folder\my_exe.exe"" /param1 /param2"

    This still encloses the path/filename in quotes, in case there are any
    spaces in the path.

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --

     
    Richard Mueller [MVP], Jun 10, 2009
    #6
  7. Tyler Durden

    Al Dunbar Guest

    That only means you cannot pre-specify what the fully qualified path is. But
    surely your script can determine what it should be, find the file, and then
    run it?

    /Al
     
    Al Dunbar, Jun 10, 2009
    #7
  8. Tyler Durden

    Tyler Durden Guest

    That's what I want :)


     
    Tyler Durden, Jun 10, 2009
    #8
  9. Tyler Durden

    Tyler Durden Guest

    I'll try and give feedback here.

     
    Tyler Durden, Jun 10, 2009
    #9
  10. Tyler Durden

    jford Guest

    Have you echo'd out WSHShell.CurrentDirectory just to make sure it is where
    you think it is? Also do you have "On Error Resume Next" in the script?
     
    jford, Jun 11, 2009
    #10
  11. Tyler Durden

    Tyler Durden Guest

    the long story:

    i was using a 'portable' latest remote desktop (mstsc.exe) that supports
    /admin, on many client computers without lose time installing it. the
    problem on x64 was not the vbs (with the command line to the portable mstsc)
    but in the fact that no matter what command line you use the system will
    always run his own outdated version 5 x64. since I've not updated it, the
    command line parameter /admin wasn't accepted. Solved using the old
    /console, that still works.

    why don't I use a single rdp file? isn't the shortest to type at command
    line and in some systems it asks for a confirmation with a security warning.

    thanks to everyone!


     
    Tyler Durden, Jun 11, 2009
    #11
  12. Why did you chose to hide the name of the executable from this newsgroup,
    calling it "my_exe.exe" instead? If you had been a little less secretive
    then this issue would have been resolved much more quickly!
     
    Pegasus [MVP], Jun 11, 2009
    #12
  13. Tyler Durden

    Tyler Durden Guest

    I didn't exactly choose - mstsc is the long story, just wanted to avoid
    that.
     
    Tyler Durden, Jun 12, 2009
    #13
  14. Tyler Durden

    Tyler Durden Guest

    ....and I'm going back to /admin, just discovered that the /console parameter
    is accepted without errors but does not work... I'll have to update remote
    desktop client on x64 systems.
     
    Tyler Durden, Jun 12, 2009
    #14
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.