VMware {code} Community
BadriV
Contributor
Contributor

How to ignore quotes in vmrun commands

Hi,

I am trying to execute a vmrun command like below which is working fine.

vmrun -T esx -h https://test.eng.vmware.com/sdk -u root -p password -gu root -gp password runProgramInGuest "[datastore] test/test.vmx" /bin/rpm -i /root/expect-5.43.0-5.1.x86_64.rpm

But if I execute it like below (please note I've mentioned the programName in quotes)

vmrun -T esx -h https://test.eng.vmware.com/sdk -u root -p password -gu root -gp password runProgramInGuest "[datastore] test/test.vmx" "/bin/rpm -i /root/expect-5.43.0-5.1.x86_64.rpm"

then I am getting an error "Error: A file was not found"

Why is this difference..?

I need that command to be worked in the second format also. Because I am trying to execute it from java where I am passing all the details as strings. So it is getting executed with quotes and I am getting the same error "Error: A file was not found".

Any solution..?

Regards,

Badri.

Reply
0 Kudos
2 Replies
BadriV
Contributor
Contributor

One more observation is that if the VM on which we are running the program is a windows VM, then quotes doesn't matter. The command is getting executed with or without quotes successfully.

But if it is a linux vm then only without quotes work.

Reply
0 Kudos
BadriV
Contributor
Contributor

Workaround: I put the rpm installation line in a shell script and executed it using runProgramInGuest and it worked.

Reply
0 Kudos