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 LICENSE NUMBERS, ACTIVATION 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.
This topic is 6 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
JMS_PT
Posts: 73
Last visit: Mon Sep 24, 2018 10:26 am

Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Ampersand not allowed in vbscript exe running in PS

Post by Alexander Riedel »

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 11011 times
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
JMS_PT
Posts: 73
Last visit: Mon Sep 24, 2018 10:26 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT »

Thank you.
User avatar
JMS_PT
Posts: 73
Last visit: Mon Sep 24, 2018 10:26 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT »

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: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Ampersand not allowed in vbscript exe running in PS

Post by Alexander Riedel »

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
Last visit: Mon Sep 24, 2018 10:26 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT »

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 10930 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 10930 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 10930 times
User avatar
JMS_PT
Posts: 73
Last visit: Mon Sep 24, 2018 10:26 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT »

Final error after clicking the message box error.
access denied2.png
access denied2.png (4.82 KiB) Viewed 10925 times
thank you.
User avatar
JMS_PT
Posts: 73
Last visit: Mon Sep 24, 2018 10:26 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT »

Any news about this one?
User avatar
JMS_PT
Posts: 73
Last visit: Mon Sep 24, 2018 10:26 am

Re: Ampersand not allowed in vbscript exe running in PS

Post by JMS_PT »

Anyone?
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Ampersand not allowed in vbscript exe running in PS

Post by Alexander Riedel »

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.
This topic is 6 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.