Showing posts with label Windows 10. Show all posts
Showing posts with label Windows 10. Show all posts

Friday, May 3, 2024

Cannot start cmd.exe on Windows 10

Somehow I encountered the problem that I could not start the Windows Command Prompt (cmd.exe). The solution turns out is to remove a key from the registry. A number of posts points to the removal of HKCU\Software\Microsoft\Command Processor\AutoRun. A complexity comes from the factor that the user account is a standard user account; howeer, regedit needs to run as an administrator, which means the HKCU is the administrator, not the standard user.

To address this issue, we can perform the following steps

  1. Figure out the user's sid:
    
        whoami /user
        
    The sid begins with S- that we can easily recognize from the output.
  2. Open regedit, and browse to HKEY_USERS, to the user according to the user's sid, to Software, to Microsoft, to Command Processor, and then locate AutoRun, and remove it.

A StackOverflow post indicates several more keys to remove, but it is not necessary in my case, but it is good to document it, just in case in the future


reg delete "HKCU\Console" /f
reg delete "HKCU\Software\Microsoft\Command Processor" /v "AutoRun" /f
reg delete "HKLM\Software\Microsoft\Command Processor" /v "AutoRun" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File 
Execution Options\cmd.exe" /f

Sunday, January 14, 2024

Saturday, July 30, 2022

Windows 10 does not know some "devices" of a Dell Precision Workstation

I was installing Windows 10 on a Dell Precision T3620 Workstation. Although the systems worked well, it bothers me that the Windows Device Manager reported that some devices were not recognized, i.e., an yellow exclamation point on the devices, like the following screenshot shows,

In fact, these unrecognized devices are,

  • PCI Data Acquisition and Signal Processing Controller,
  • PCI Memory Controller, and
  • SM Bus Controller

It turns out that many users had similar problem, and the solution is to update some device drivers. However, I was slightly frustrated that the very driver that solved my problem (all three unrecognized devices) wasn't listed under "driver" on the Dell Support's website. Instead, it was listed under "Utility", and was the "Intel Chipset Device Software."

Wednesday, June 15, 2022

Cannot Safely Remove USB Drive on Windows 10? Use Diskpart

From time to time, I cannot safely remove or eject a USB drive. The reason is that one or more processes locks some files. For instance, I observed the following files were locked by a svchost.exe process on the USB drive F:,

F:\$Extended$
F:\System Volume Information\

The method that works consistently for me is to use Diskpart. Note this requires administrative privilege.   Below is an example to remove the external drive (shown as Disk 1),

C:> diskpart
DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB        *
  Disk 1    Online         1862 GB      0 B

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> offline disk

DiskPart successfully offlined the selected disk.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB        *
* Disk 1    Offline        1862 GB      0 B

To bring the disk back online without re-plugging it, we do the steps illustrated in the example below,
C:> diskpart
DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB        *
* Disk 1    Offline        1862 GB      0 B

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> online disk

DiskPart successfully onlined the selected disk.

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB        *
* Disk 1    Online         1862 GB      0 B

DISKPART>

Tuesday, June 8, 2021

Solving problem updating Windows 10 to version 20H2 or newer

I have been trying to update Windows 10 to Windows 10 version 20H2. The problems that I  encountered are,

  1. When using Windows Update, I saw the update process stuck at 61%, eventually failed. I am not the only one, clearly. For instance, there are numerous online threads. Here are several examples, example 1, example 2, and example 3. Want to see more, just Google it. 
  2. When using Windows 10 Update Assistant, one of the recommended method, I saw it stuck at 99%, for eons. 

 Finally, I found the right answer, i.e., the method documented in this post,

This  method worked for me. The caveat is that 1) contrast of using Windows update, I have to wait for two to three hours before it finishes; 2) it updates my Windows to 21H1 directly. Regardless, updating to a new version is what I wanted since Microsoft is going to cease supporting older versions of Windows 10.

The steps as outlined in the article linked in the above are,

  1. Open File Explorer, type C:\$GetCurrent, and then press Enter.
  2. Copy and paste the Media folder to the desktop. If you don't see the folder, select View and make sure the check box next to Hidden items is selected.
    Restart your PC, open File Explorer, type C:\$GetCurrent in the address bar, and then press Enter.
  3. Copy and paste the Media folder from the desktop to C:\$GetCurrent.
  4. Open the Media folder and double-click Setup.
  5. Follow the instructions to start the upgrade. On the Get important updates screen, select Not right now, and then select Next.
  6. Follow the instructions to finish upgrading to Windows 10. After you're done, make sure to install available updates. Select the Start  button, and then select Settings  > Update & Security  > Windows Update > Check for updates.



Thursday, August 27, 2020

X Servers for Windows

When we run multiple thin Linux/Unix systems on virtual machines on a Windows host, we wish to have X server for windows. There are in fact a few free ones, at least for personal use. Here are some of these X servers.

  • MobaXterm that integrates PuTTY and Cygwin/X with feature-rich GUI
     
  • VcXsrv that is based on from xorg's source code, compiled with Visual Studio (Visual C++, so vc - X - srv)
     
  • Cygwin/X.
     
  • Xming. An older version of Xming is available for free, but new versions require a donation like $20. 

Monday, June 1, 2020

Problem: Application Icon on Windows Taskbar Becomes White Square

I was using a Windows 10 system. I noticed somehow the icon of application on the taskbar became a white square, like this picture shows,


I figured out a solution to resolve this. That is to delete the thumbnail icon cache that we can find at %LOCALAPPDATA%\Microsoft\Windows\Explorer, i.e.,

  1. Open a Windows Command Prompt window
  2. Do the following from the command line on the Windows Command Prompt window
    1. taskkill /F /IM explorer.exe
    2. del %LOCALAPPDATA%\Microsoft\Windows\Explorer\thumbcache_*.db
    3. explorer.exe
Sometimes, it is also necessary to remove all the thumbnails themselves, i.e., run the Disk Cleanup application. From the command line, that is,
  1. Run the Disk Cleanup application, i.e., cleanmgr.exe
  2. Uncheck everything using the user interface, and check "Thumbnails" (See the screen shot). 
  3. Click OK to confirm
  4. Exit the Disk Cleanup application

The system will rebuild the thumbnail cache and the thumbnails.

Sunday, May 24, 2020

"grep" does not work on WSL?

Does "grep" not always work on the Windows Subsystem for Linux (WSL) on Windows 10? I has been investigating this problem that bothered me a great deal. Here is what I saw,

$ vi josh.txt

What I saw in vi is,

  Josh
  Anonymous
~       
~                                                                        ~  

OK, let's grep something ...

$ grep "Josh" josh.txt
$ echo $?
1

Should I have seen a match and exit-code 0 instead? I haven't gotten a clue until I ran strace,

$ strace grep "Josh" josh.txt
...
openat(AT_FDCWD, "josh.txt", O_RDONLY|O_NOCTTY) = 3
fstat(3, {st_mode=S_IFREG|0777, st_size=42, ...}) = 0
read(3, "\377\376 \0 \0J\0o\0s\0h\0 \0\r\0\n\0 \0 \0A\0n\0o\0n\0"..., 98304) = 42
read(3, "", 98304)                      = 0
close(3)                                = 0
...
$

Good, I saw 'J', 'o, ..., but what are these '\377', '\376', ... Instead of doing octal numbers to hexadecimal number conversion, I let strace do this for me, and

$ strace grep "Josh" josh.txt
...
openat(AT_FDCWD, "josh.txt", O_RDONLY|O_NOCTTY) = 3
fstat(3, {st_mode=S_IFREG|0777, st_size=42, ...}) = 0
read(3, "\xff\xfe\x20\x00\x20\x00\x4a\x00\x6f\x00\x73\x00\x68\x00\x20\x00\x0d\x00\x0a\x00\x20\x00\x20\x00\x41\x00\x6e\x00\x6f\x00\x6e\x00"..., 98304) = 42
read(3, "", 98304)                      = 0
close(3)                                = 0                            = 0
...
$

Huh? No characters? What are these "\xff\xfe\x20\x00..."? How about

$ cat josh.txt
    J o s h
     A n o n y m o u s
$

At this moment, I realized that the character encoding is neither ASCII nor UTF-8, and it must be something else, and the leading bytes are the "Byte Order Marks (BOM)". Windows API documentation has a page that has the following,

Byte order markDescription
EF BB BF UTF-8
FF FE UTF-16, little endian
FE FF UTF-16, big endian
FF FE 00 00 UTF-32, little endian
00 00 FE FF UTF-32, big-endian
Note
A byte order mark is not a control character that selects the byte order of the text.

It turns out the text file is encoded in "UTF-16, little endian". Just for fun, I ran file,

$ file josh.txt
josh.txt: Little-endian UTF-16 Unicode text, with CRLF line terminators
$

That's it! I got this file from downloading it in Webex on the Windows host, and Webex must have encoded it in the Windows default encoding scheme, "UTF-16, little endian".

How do I grep this file? There might be many other methods. But I just use the iconv command  to convert the encoding from utf-16 to utf-8, and then redirect the output to grep, like,

$ iconv -f utf-16le -t utf-8 josh.txt | grep "Josh"
  Josh
$ echo $?
0
$

Problem solved!

Sunday, May 17, 2020

Failed to Start Virtual Machine in VMWare Workstation Player

I upgraded VMWare Workstation Player to 15.5.2 on a Windows 10 host. It failed to start any virtual machines after the upgrade. The error message is

VMware Player and Device/Credential Guard are not compatible. VMware
Player can be run after disabling Device/Credential Guard. Please visit
http://www.vmware.com/go/turnoff_CG_Dg for more details. 
 

I followed the instruction to make sure that the Device Guide was disabled. Since I have a Windows Pro, to disable Device Guard, I run the Local Group Policy Editor

mmc gpedit.msc


However, the problem remains. It turned out an additional step was need, that was to run the following command as the system adiministrator and reboot the Windows host,

bcdedit /set hypervisorlaunchtype off 

Wednesday, November 13, 2019

When SFC Cannot Fix Corrupted Windows Files, DSIM Comes to Rescue

Just as the title suggested, on a Windows 10 host, I encountered a case that SFC reported that it could not fix corrupted files, and DSIM in this case helped. Below is the screen transcript.

C:\WINDOWS\system32>sfc /scannow

Beginning system scan.  This process will take some time.

Beginning verification phase of system scan.
Verification 100% complete.

Windows Resource Protection found corrupt files but was unable to fix some of them.
For online repairs, details are included in the CBS log file located at
windir\Logs\CBS\CBS.log. For example C:\Windows\Logs\CBS\CBS.log. For offline
repairs, details are included in the log file provided by the /OFFLOGFILE flag.

C:\WINDOWS\system32>Dism /Online /Cleanup-Image /RestoreHealth

Deployment Image Servicing and Management tool
Version: 10.0.17763.771

Image Version: 10.0.17763.805

[==========================100.0%==========================] The restore operation completed successfully.
The operation completed successfully.

C:\WINDOWS\system32>sfc /scannow

Beginning system scan.  This process will take some time.

Beginning verification phase of system scan.
Verification 100% complete.

Windows Resource Protection found corrupt files and successfully repaired them.
For online repairs, details are included in the CBS log file located at
windir\Logs\CBS\CBS.log. For example C:\Windows\Logs\CBS\CBS.log. For offline
repairs, details are included in the log file provided by the /OFFLOGFILE flag.

C:\WINDOWS\system32>sfc /scannow

Beginning system scan.  This process will take some time.

Beginning verification phase of system scan.
Verification 100% complete.

Windows Resource Protection did not find any integrity violations.

C:\WINDOWS\system32>