How to avoid this WriteLine failure in TextPad tool? - wsh

Cscript.exe with this script
Wscript.StdOut.WriteLine( "Test " & ChrW(&H2460))
works fine in a CMD window but in a TextPad tool fails with
Microsoft VBScript runtime error: Invalid procedure call or argument
How can I remedy this?
Changing Tool Output default encoding does not remedy this. http://i.imgur.com/dSF1XEt.png
http://i.imgur.com/UIxh5cU.png
http://i.imgur.com/80qob5n.png
I am running TextPad 7.5.1 in Windows 7 Pro 64-bit.

I reproduced your error by running your command via WScript.
Change your code to use the WScript.Echo command instead of the WScript.StdOut.WriteLine command. E.g.
WScript.Echo "Test " & ChrW(&H2460)
This command works in both CScript and WScript. So, this should work for you in your TextPad tool as a valid VBA command.

Related

PhpStorm 2019.3.4 External Tools the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'

I'm using Laradock, now I want to set up External Tools in my PhpStorm 2019.3.4 so that it's easy for me to run the command and no extra effort to type it. But I get unexpected error:
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
Note: I am using Windows 10
Here is how I setup
Tools Settings:
Program: C:\Program Files\Docker\Docker\resources\bin\docker-compose.exe
Arguments: exec workspace bash
External tools console is non-TTY (related feature request: IDEA-103276); and docker commands are by default allocating a TTY (https://docs.docker.com/compose/reference/exec/)
Enabling COMPOSE_INTERACTIVE_NO_CLI (https://docs.docker.com/compose/reference/envvars/#compose_interactive_no_cli) is a workaround, but it doesn't work on Windows:(

wscript access denied but cscript works

I have a simple vbs script that popups a message
Msgbox("Here")
I can run it using cscript
cscript hello.vbs
and it works fine. But if I try to run it using wscript, I get an error saying "Access is denied". How can I get it to run with wscript?
thanks
Cscript.exe is a command-line version of the Windows Script Host.
By Design "Windows Script Host supports scripts written in VBScript or JScript.".
It can run hello.vbs because this file is a VB Script.
And again by design, I cannot run a WScript which is a windows Shell script.
WScript by itself can be executed and does not need other programs to run it.

PsExec is not recognized as an internal or external command

I have a job that needs to run a script on a remote computer. I'm doing so by using psexec via "Execute windows batch command":
C:\PsExec.exe \\computername -u username -p password -accepteula c:\xxx.exe
When I run the job I get the following error:
c:\PsExec.exe is not recognized as an internal or external command
** PsExec.exe is located under c:\
Any ideas?
First Define psexec.exe path in environment varaiable "PATH" or else place psexec.exe file in C:\Windows\System32\
And to Download Psexec.exe file
https://download.sysinternals.com/files/PSTools.zip
One possible explanation is the version of PsExec.exe: 32bits or 64bits.
If you have the 32 one on a 64bits machine, that command would not be recognized indeed. PsExec64.exe would.
I can see the age of this question and my answer may not be relevant to this topic since I was technically trying to solve a different problem, but maybe this will help other people who are stuck.
c:\PsExec.exe is not recognized as an internal or external command
I was trying to disable the Maintenance Configurator with PSExec (my problem is the never ending maintenance bug) and kept running into the same error as the OP BUT I got PSexec64 to run this command:
C:\PsExec64.exe -s schtasks /change /tn >"\Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE
BY checking the "Run this program as an administrator" option under the Compatibility settings for "PsExec64.exe"
Don't know if this has solved my problem yet, but I think the OP would have been able to run his process if he had done this. Dear OP did you ever solve that?

PowerShell command not executed?

In the following PowerShell v2.0 script, the command & is not executed :
$SqlPackageExe = "C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\sqlpackage.exe"
Write-Host "Before SqlPackage"
& "$SqlPackageExe" /Action:Publish $SqlPackageParameters
Write-Host "After SqlPackage"
On the console output, I see :
Before SqlPackage
After SqlPackage
I have no error, no log, nothing of the SqlPackage.exe. What's happen ?
My command "& "$SqlPackageExe" /Action:Publish $SqlPackageParameters" works a first time, a second time (database is deployed), and then stops working.
If I close the PowerShell session and open a new PowerShell session, the command works several times, then stops working.
Thank you for your help
You need to redirect StdError and StdOut, see the answer that discusses " -RedirectStandardError -RedirectStandardOutput":
Powershell: Capture program stdout and stderr to separate variables

What caused this unhelpful Powershell ISE error message?

I'm trying to use Powershell ISE as a console app with little success. Comskip is a command line tool and I'm having a AHK script executing the Comskip commercial stipping normally through cmd.exe. Works fine, but lately I started using Unicode characters (star-rating) in the filenames and as you all know these won't display especially good in the console.
Investigation led me to Powershell ISE which is supposed to support Unicode. Running Comskip from ISE proved to be quite challenging. It works fine if typing in everything manually, but the problem starts when calling it from an another script.
Now the problematic part is if using the code calling the ordinary Powershell console it all went fine. But the same code calling the ISE fails and I can't see why. Can any of you? The error message I get doesn't give any explicit clues on what went wrong. The error message only says:
Usage: powershell_ise.exe or powershell_ise.exe fileName.ps1
The AHK line calling the ISE looks like this:
latest_file := "C:\Program\Comskip\q.ts"
Run, PowerShell_ISE.exe "C:\Program\Comskip\comskip.exe" -t --videoredo "%latest_file%"
Now if using the Powershell console the same code executes alright:
latest_file := "C:\Program\Comskip\q.ts"
Run, PowerShell.exe "C:\Program\Comskip\comskip.exe" -t --videoredo "%latest_file%"
How come I get these anomalies?
PowerShell ISE does not have ability to run commands like powershell.exe has. Reason for that is simple: ISE was designed as an interactive environment where powershell.exe had been thought out as something both for interactive and "batch" operations, like the one you tried to complete.
The error you get is IMO descriptive enough: you can only run PowerShell_ISE (no paramters) or specify .ps1 file that ISE will open once it started. In v3 there are 2 new added ( -NoProfile and -MTA) but still - nobody designed it as batch processing tool.. sorry.

Resources