Ampersand not allowed in vbscript exe running in PS

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
JMS_PT
Posts: 73
Joined: Wed Dec 09, 2015 4:10 am

Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT » Sat Jul 22, 2017 5:36 am

Hi,
I`m using PrimalScript Version 7.3.103 x64

I have a vbscript that I converted to exe (x86 and x64). Since I want to run the exe in memory I choose the "Sapien PowerShell v2 (commandline)" Script Engine under Package Settings Window with Target = MS windows 32 and 64 Bit (not sure if I have other options to run exes in memory).

When I run the exe on the client host I get:
Ampersand not allowed. The & operator is reserved for future use; use "&" to pass ampersand as a string.

I have a lot of Ampersands in this script... Can we workarround this?
As long as I can run the exe in memory (not in temporary file) I`m fine with it.

Thank you.

User avatar
Alexander Riedel
Posts: 7098
Joined: Tue May 29, 2007 4:43 pm

Re: Ampersand not allowed in vbscript exe running in PS

Post by Alexander Riedel » Sat Jul 22, 2017 10:47 pm

The problem is not with the ampersand characters in your code. You selected a PowerShell engine to execute VBscript code. Obviously the PowerShell engine would not know what to do with VBScript code. It interprets the code as PowerShell and thus complains about these characters.
For what you seem to be intending to do, the SAPIEN Script Host engine seems to be the appropriate choice.
Attachments
2017-07-22_22-42-37.png
2017-07-22_22-42-37.png (102.48 KiB) Viewed 7672 times
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
JMS_PT
Posts: 73
Joined: Wed Dec 09, 2015 4:10 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT » Sat Jul 22, 2017 11:21 pm

Thank you.

User avatar
JMS_PT
Posts: 73
Joined: Wed Dec 09, 2015 4:10 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT » Mon Jul 24, 2017 2:57 am

I have another problem with this exe, when running in windows 2003 I get the error
"c:\myapp.exe is not a valid Win32 application".
Then in cmd line I see "Access is denied."
In other OS works ok.

How can I solve this?
Thank you.

User avatar
Alexander Riedel
Posts: 7098
Joined: Tue May 29, 2007 4:43 pm

Re: Ampersand not allowed in vbscript exe running in PS

Post by Alexander Riedel » Mon Jul 24, 2017 5:10 am

I do not really know what "this exe" is :D Please keep in mind that we cannot see your computer.
"not a valid win32 application" generally happens when you try to run a 64 bit exe on a 32 bit computer.
It is also possible that you need to unlock the file if you simply copied it from another computer on the network.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
JMS_PT
Posts: 73
Joined: Wed Dec 09, 2015 4:10 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT » Mon Jul 24, 2017 8:44 am

I`m sorry for the lack of information.
exe is an vbscript converted to exe using the options
SAPIEN Script Host (Command Line) / "Microsoft Windows Native"
Native.png
Native.png (59.59 KiB) Viewed 7591 times
This means that I`m left with 3 converted executables, 1 that i can "Call" and other 2 for x64 and x86.
For example:
MyScript01.exe
MyScript01x86.exe
MyScript01.x64.exe

I understand that appears that the message suggests that I`m running the wrong version of the OS, but I also try to compile to 32Bit only (rather than "Microsoft Windows Native") by changing the option Target to Microsoft Windows 32Bit, but I get the same message.
32bit.png
32bit.png (59.25 KiB) Viewed 7591 times
The error (note: the access denied error only appears after I click ok in the dialog message)
access denied.png
access denied.png (8.49 KiB) Viewed 7591 times

User avatar
JMS_PT
Posts: 73
Joined: Wed Dec 09, 2015 4:10 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT » Mon Jul 24, 2017 8:53 am

Final error after clicking the message box error.
access denied2.png
access denied2.png (4.82 KiB) Viewed 7586 times
thank you.

User avatar
JMS_PT
Posts: 73
Joined: Wed Dec 09, 2015 4:10 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT » Tue Jul 25, 2017 11:30 am

Any news about this one?

User avatar
JMS_PT
Posts: 73
Joined: Wed Dec 09, 2015 4:10 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT » Thu Jul 27, 2017 2:03 pm

Anyone?

User avatar
Alexander Riedel
Posts: 7098
Joined: Tue May 29, 2007 4:43 pm

Re: Ampersand not allowed in vbscript exe running in PS

Post by Alexander Riedel » Thu Aug 10, 2017 6:26 am

Windows 2003 is equivalent to Windows XP. We really do not support or test for this platform anymore.
I did a quick test, packaging a Hello World VBScript file and ran it on an old XP 32 bit VM. It ran just fine.
So I am quite certain that the problem lies with your specific machine, but I am at a loss about how to determine what it would be.
Alexander Riedel
SAPIEN Technologies, Inc.