Page 1 of 1

Ampersand not allowed in vbscript exe running in PS

Posted: Sat Jul 22, 2017 5:36 am
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.

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Sat Jul 22, 2017 10:47 pm
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.

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Sat Jul 22, 2017 11:21 pm
by JMS_PT
Thank you.

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Mon Jul 24, 2017 2:57 am
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.

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Mon Jul 24, 2017 5:10 am
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.

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Mon Jul 24, 2017 8:44 am
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 8331 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 8331 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 8331 times

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Mon Jul 24, 2017 8:53 am
by JMS_PT
Final error after clicking the message box error.
access denied2.png
access denied2.png (4.82 KiB) Viewed 8326 times
thank you.

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Tue Jul 25, 2017 11:30 am
by JMS_PT
Any news about this one?

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Thu Jul 27, 2017 2:03 pm
by JMS_PT
Anyone?

Re: Ampersand not allowed in vbscript exe running in PS

Posted: Thu Aug 10, 2017 6:26 am
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.