Results 1 to 4 of 4

Thread: RESOLVED: SHELL command - having trouble using parameters

  1. #1

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    RESOLVED: SHELL command - having trouble using parameters

    Hello,

    I want to convert a line of code that's been using within a batchfile, to vb6:
    Code:
    C:
    cd "\Program Files (x86)\VMware\VMware Workstation" 
    call vmrun stop "C:\__VMWARE MACHINES\Machine1\Machine1.vmx" hard
    This works! It runs vmrun.exe, using the parameter 'stop', then the path of the file... (which successfully stops a virtual machine)

    In vb6 I've tried the following:
    Shell "C:\Program Files (x86)\VMware\VMware Workstation\vmplayer.exe", vbNormalFocus
    ...this works. I tried running vmplayer.exe just to make sure I'm heading the right way.

    Then tried the following:
    Shell "C:\Program Files (x86)\VMware\VMware Workstation\vmrun stop C:\__VMWARE MACHINES\Machine1\Machine1.vmx", vbNormalFocus
    ...This didn't work. I've tried many alterations, adding quotation marks here and there (to encapsulate the .vmx part), trying double-quotes, even 8dot3 paths.

    So easy from a batch file... but still clueless on how to do it straight from vb6..

    Any help greatly appreciated!
    Last edited by Krass; Feb 26th, 2014 at 05:37 PM. Reason: *Resolved*
    Chris

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: SHELL command - having trouble using parameters

    The first one I would try would be
    Code:
    Shell """C:\Program Files (x86)\VMware\VMware Workstation\vmrun"" stop ""C:\__VMWARE MACHINES\Machine1\Machine1.vmx""", vbNormalFocus

  3. #3

    Thread Starter
    Hyperactive Member Krass's Avatar
    Join Date
    Aug 2000
    Location
    Montreal
    Posts
    489

    Re: SHELL command - having trouble using parameters

    That was a good call. It worked. Thank you very much.

    ... taking notes
    Chris

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: RESOLVED: SHELL command - having trouble using parameters

    Quotation marks around the executable's path in the Shell call doesn't appear to be necessary. The following works just as well:

    Code:
    Shell "C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe stop ""C:\__VMWARE MACHINES\Machine1\Machine1.vmx"" hard", vbNormalFocus
    Note the inclusion of the parameter "hard" at the end of the command line (which you seem to have missed in your OP). Also, it would be best to specify the fully-qualified path of the executable so as to prevent situations where a file having a similar name but different extension (such as .COM) exists in the same directory.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width