Sign in to follow this  
Followers 0
GAM

Runwait is not working

4 posts in this topic

HI,
 
I trying to copy a file from Host operating system to Guest operating system via VMWare-Workstation. The command prompt appears but disappears in a split of a second. Not sure where am going wrong. Can someone help please?
 
Here is the script that I have written...
 
$VWRunEXEPath = "C:Program Files (x86)VMwareVMware Workstation>vmrun.exe"
$GuestUserName = "agovada"
$GuestPwd = "Welcome2world"
$VMXPathOfTheOS = """C:VMImagesVista-64Vista x64.vmx"""
$SourcePathOfVSE = """C:dataVSE RP4 RTW.zip"""
$TargetPathOfVSE = """C:buildsrp4.zip"""
 
RunWait(@ComSpec  & " /c " & "'" & $VWRunEXEPath & " -T ws -gu " & $GuestUserName & " -gp " & $GuestPwd & " copyFileFromHostToGuest " & $VMXPathOfTheOS & " " & $SourcePathOfVSE & " " & $TargetPathOfVSE &"'")
 
NOTE : If I execute the command on cmd prompt then it works fine. Here's the actual command : "C:Program Files (x86)VMwareVMware Workstation>vmrun.exe" -T ws -gu agovada -gp Welcome2mcafee copyFileFromHostToGuest "C:VMImagesVista-64Vista x64.vmx" "C:dataVSE RP4 RTW.zip" "C:test1rp4.zip"
 
Thanks in advance.

Neil

Share this post


Link to post
Share on other sites



A correction : Please read $GuestPwd = "Welcome2world" as $GuestPwd = "Welcome2mcafee"


Neil

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Are you sure you want the > in stead of a before vmrun.exe?

Change the /C to /K on your CMD.exe line to keep the CMD window open to check for messages.

Jos

ps this has similar quotations as your example commandline:

RunWait(@ComSpec  & ' /k "' & $VWRunEXEPath & '" -T ws -gu '  & $GuestUserName & ' -gp ' & $GuestPwd & ' copyFileFromHostToGuest "' & $VMXPathOfTheOS & '" "' & $SourcePathOfVSE & '" "' & $TargetPathOfVSE & '"')
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Hey, it worked after I replaced "" with ">". 

Very bad on my part, it was a very silly mistake.

Thanks a lot jos.


Neil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • breakbadsp
      By breakbadsp
      I want to run a python script from autoit. 
      I know we can do this with shellexecute or run , but this python script takes 3 cmd line arguments.
      How to pass them from autoit script?
      I tried many ways.
      Following solution also not working 
      e.g. 
      RunWait( 'fullpath\Python.exe Scriptpath\ReadLog.py  -f "file.log" -k "key" -e "errMsg" ') Found solution:
      RunWait( 'fullpath\Python.exe ReadLog.py -f "file.log" -k "key" -e "errMsg" ', 'Working_directory_path')  
      PFB description:
      https://stackoverflow.com/questions/45757834/how-to-pass-command-line-arguments-to-a-python-script-anyscript-while-executin
       
    • StMaSi
      By StMaSi
      I'm attempting to code a Run or RunWait command that is a little on the long side and contains multiple sets of embedded quotes (as it would be issued from a CMD prompt), but can't for the life of me figure out the containing quotes as pertains to AutoIt. Here's the one-line command as it would be issued via a CMD prompt...
      "\\AppServ\G$\Connectivity\Clients\Citrix\Receiver\14.5.0.10018\CitrixReceiver.exe" ADDLOCAL="ReceiverInside,ICA_Client,WebHelper,SSON,AM,SELFSERVICE,USB,DesktopViewer,Flash,Vd3d" ALLOWADDSTORE=A ALLOWSAVEPWD=A ENABLEPRELAUNCH=Y ENABLE_SSON=Yes STORE0="AppStore;https://receiver.domain.net/Citrix/Apps/discovery;on;AppStore" /EnableCEIP=false /includeSSON /noreboot /silent I've tried so many different combinations of surrounding quotes with Run and RunWait, I just don't understand why it's this difficult to get past this.
      Can anyone assist with this?
      Thank you.
    • WannaBeGut
      By WannaBeGut
      Hello,
      I just wrote a script that should copy data into my cloud using xcopy (cmd), but I want the Status Bar I have in my GUI to change it's text like that:
      working. -> working.. -> working... -> working. ...
      I would also like to make a button which interrupts xcopy (simply closing it should do the trick), but I don't know how to call ProcessClose("xcopy.exe") using a button, while I'am waiting for RunWait to finish.
      Example:
      $command = 'xcopy "' & @DesktopDir & '\text.txt"' & ' "\\ADMIN-CLOUD\private\" /EECHIY' $SW_STATE = @SW_HIDE RunWait(@ComSpec & " /c " & '"' & $command & '"', @DesktopDir, $SW_State) Please tell me if you need any further information! 
    • ur
      By ur
      I have written a script to build the Installshield project file(.ism) to setup files(.msi or .exe based on the release settings..).
      So when the user runs the script the process will be automatic for multiple ism files.
      Func Build($sOutputIsm,$ReleaseName,$sFilePath="None",$NewName="None") ;build the ism to get the msi If not FileExists($sOutputIsm) Then Logging("File Not Found: $sOutputIsm$",4) MsgBox($MB_OK + $MB_ICONERROR, "Error", "Could not find file ""$sOutputIsm$"".") Return EndIf Logging("Started Building $sOutputIsm$",4) ShowTrayTip($AppName, "Started Building $sOutputIsm$", 10, $TIP_ICONASTERISK) Dim $sBuildExe,$sBuildCommand,$Ret $sBuildExe = FindFileInPath("ISCmdBld.exe", "%ProgramFiles(x86)%\InstallShield") $sBuildCommand = """$sBuildExe$"" -p ""$sOutputIsm$"" -r ""$ReleaseName$"" -s" ;MsgBox(0,"",$sBuildCommand) $Ret = RunWait($sBuildCommand) If $Ret <> 0 Then ShowTrayTip($AppName,"ISM Build Failed, Please build the ISM Manually.",10, $TIP_ICONHAND) MsgBox($MB_OK + $MB_ICONERROR, "Error", "Could not build ""$sOutputIsm$"". Please build manually.") Logging("Error $Ret$ while Building $sOutputIsm$",4) Return;Exit(1) Else ShowTrayTip($AppName,"ISM Build Completed",10, $TIP_ICONASTERISK) Logging("Completed Building $sOutputIsm$",4) if not StringCompare($NewName, "None")=0 then MoveEXE($sFilePath,$NewName) EndIf EndFunc The problem is when we run the ISCmdBuild.exe the RunWait will give whether fail or success but not what are the errors we got.
      If we use Run, it will give that logging but we don't have the feature of getting fail/success as RunWait.
      If we run the above code by removing -s and using redirection operator > to a file, it is running manually but failing with autoit.
      Like
       
      $sBuildCommand = """$sBuildExe$"" -p ""$sOutputIsm$"" -r ""$ReleaseName$"" > c:\logs\uday.log" Any help on this??
       
      And also, in some machines the installshield shortcut is launching fine as licensed version but with ISCmdBld.exe it is giving error as licensing info missing or not registered.
       
      Any suggestion on this too??
    • Eggsplorer
      By Eggsplorer
      Hi,
      I want to install chocolatey (https://chocolatey.org/) with AutoIt.
      I just need to send the following command to cmd:
      @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin This is what I tried:
      RunWait(@ComSpec & " /C " "@powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin", ""); It didn't work propably because of the quotes.
      So I tried this:
      $code1 = "@powershell -NoProfile -ExecutionPolicy unrestricted -Command" $code2 = " (iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" $code3 = " && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" RunWait(@ComSpec & " /C " & $code1 & $code2 & $code3, ""); Didn't work either.
      Any help?
      Thanks in advance =)