simply save the following in notepad using UTF-8
msgbox "你好"
double click or run it from command line
D:\>cscript.exe /u test-unicode.vbs
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.
D:\test-unicode.vbs(1, 1) Microsoft VBScript compilation error: Invalid characte
r
is there any way to run the unicode script in Windows Script Host?
cscript.exe can run scripts saved using [Unicode] (seems UTF-16).
Related
On the command line, I can retrieve previous commands by pressing the up / down arrow keys. This doesn't work however if I nest CMDs beyond a certain depth. Why is that so and is there a way to make it work?
To reproduce, open CMD and run:
Microsoft Windows [Version 10.0.19042.1110]
(c) Microsoft Corporation. All rights reserved.
C:\>cmd
Microsoft Windows [Version 10.0.19042.1110]
(c) Microsoft Corporation. All rights reserved.
C:\>cmd
Microsoft Windows [Version 10.0.19042.1110]
(c) Microsoft Corporation. All rights reserved.
C:\>cmd
Microsoft Windows [Version 10.0.19042.1110]
(c) Microsoft Corporation. All rights reserved.
C:\>cmd
Microsoft Windows [Version 10.0.19042.1110]
(c) Microsoft Corporation. All rights reserved.
C:\>echo lands
lands
C:\>rem Pressing up here doesn't bring back "echo lands"
For more context:
I have a REPL in my Python discord.py bot which uses a subclass of the builtin code module's InteractiveConsole class that supports getting previous lines using the arrow keys (tested it by itself). I use Pew to run my bot in the right virtual environment (with pew in bot python bot.py).
The arrow keys don't work. When I run my bot, Task Manager shows 6 extra processes (processes other than the original cmd.exe and Console Window Host):
pew # Pew's executable on the PATH
python # Pew's virtual environment's Python
python # Global Python
cmd # Pew does subprocess.run(..., shell=True)
python # Bot's virtual environment's Python
python # Global Python
To confirm that it was solely the number of nested processes that mattered, I tried two more things. First, I installed Pew globally (with pip install pew) and ran the bot using python -m pew .... There were 4 extra processes (3 Pythons and 1 CMD) and the arrow keys still didn't work. Then, I made a fork of Pew that doesn't create an intermediate shell and ran the bot using it. There were 3 extra processes (all Pythons) and the arrow keys worked inside the REPL.
I still don't know why this happens, but I've resorted to using ConEmu which doesn't suffer from this issue.
When I open windows power shell, the following prompt will appear:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
Cannot load PSReadline module. Console is running without PSReadline.
What you are looking for is running powershell.exe process with -NoLogo switch :)
Microsoft Windows [Version 10.0.19042.928]
(c) Microsoft Corporation. All rights reserved.
c:\>powershell.exe
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\> exit
c:\>powershell.exe -NoLogo
PS C:\> exit
More about it here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_exe?view=powershell-5.1
I seem to have found a solution, according to the article I do a good jobenter link description here
When I open up cmd, this is what I see:
Microsoft Windows [Version 10.0.17134.523]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\me>
How would I get it to say:
Microsoft Windows [Version 10.0.17134.523]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\me\Desktop\MyFolder>
How do I do this without using cd Desktop\MyFile? When I do this, it is temporary. Restart cmd, it still shows
Microsoft Windows [Version 10.0.17134.523]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\me>
How do I get it to C:\Users\me\Desktop\MyFolder> permanently?
1. Hit the home button, and type in cmd.
2. Right-click Command Prompt. select, Open in file location.
3. Right-click Command Prompt. it should be a Shortcut.
4. Select the Shortcut tab.
5. In the Start in: text box, type in your file location. For this question it would be,
C:\Users\me\Desktop\MyFolder.
6. Hit the enter key.
I have a generic SQL file containing a boring SQL Script. Nothing unusual. However, when I try to read it using VBScript, it produces this output:
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
˜_
And nothing else. Here is my VBScript code that does not work:
Set objFSO = CreateObject("Scripting.FileSystemObject")
WScript.Echo objFSO.OpenTextFile("PARTY_FK_CONSTRAINTS.SQL").ReadAll()
I have tried this in Windows 7 as well as Windows Server 2008 R2. Also worth mentioning is that I can read it just fine in C#. I don't know if something strange is happening transparently through the filesystem or what. What's going on?
I am having an issue on my machine with PowerShell (x86). If I type:
cmd
I get no output. However, If I type this into 64-bit PowerShell, I get the output:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
And idea why this is behaving this way? It's as if PowerShell (x86) is just not executing this command. I am running 64-bit Windows 7.
Edit: cmd is just an example of what's happening. It also happens when I want to execute foo.exe in some random folder. I'm looking for a solution for the general case of running executables in 32-bit PowerShell.
Edit: In case somebody with the same issue sees this, the way I was able to fix this was by changing my ComSpec environment variable to:
C:\Windows\SysWOW64\cmd.exe
To start and open a 32-bit command prompt you need to type:
$env:windir\SysWoW64\cmd.exe