Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts

May 7, 2026

Python server to run html with Node.js script

to run Python server in cmd window,

    python -m http.server 8000


in web browser,

    http://localhost:8000/index.html


If it does not work, 

(1) install Node.js

(2) in cmd window:

    npm create vite@latest  temp  -- --template react

(3) in temp folder in cmd window:

    npm install

    npm run dev

(4) replace the generated src/App.jsx with your file contents and import your CSS in the component or main.jsx

(5) in cmd window, build:

    npm run build

(6) copy all files in the "dist" folder, and now the Python server will work


May 8, 2025

[Windows] add current folder to PATH

 To add current folder/directory to PATH environment,

in cmd windows,

    set PATH=%PATH%;%CD%



Nov 9, 2023

[Windows] to get the CD-key of current Windows

 To get the CD-key of current Windows,

1.  run  PowerShell or cmd 

2.  execute either 

    wmic path softwareLicensingService get OA3xOriginalProductKey

or

    powershell "(Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey"



Aug 10, 2022

[Windows] How to restore old photo viewer

 In Windows 10, the old photo viewer is not a default photo viewer.

The old photo viewer is fast, so if you want to restore the old photo viewer:

(1) copy the below and make a text file (e.g., aa.reg) using it.

(2) run the reg file you create.


Windows Registry Editor Version 5.00


[HKEY_CLASSES_ROOT\Applications\photoviewer.dll]


[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell]


[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open]

"MuiVerb"="@photoviewer.dll,-3043"


[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command]

@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\

00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\

6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\

00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\

25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\

00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\

6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\

00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\

5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\

00,31,00,00,00


[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget]

"Clsid"="{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}"


[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print]


[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command]

@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\

00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\

6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\

00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\

25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\

00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\

6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\

00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\

5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\

00,31,00,00,00


[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget]

"Clsid"="{60fd46de-f830-4894-a628-6fa81bc0190d}"


Aug 17, 2021

[Windows] how to delete specified files including those in all sub-folders at once

 In Command Prompt window,

          del   /s   *.txt 

It will delete all files with extension "txt", all files including those in all sub-folders.


You can add "/f", "/q" like   del  /s /f /q  *.txt

/f : force to delete read-only files

/q: it won't ask you to confirm deletion



If you want to delete all files and sub-folders at once,

        rmdir  /s  aaa

where aaa is the name of folder you want to delete.


Aug 13, 2021

[Python] how to create a Python code from your GUI design created in Qt Designer

You've finished designing your GUI in Qt Designer and now you want to create a Python code from it.

1. Open "Command Prompt" in Windows.

2. Move to a folder where your GUI has been saved.

3. Run:

          pyuic6   file_name_of_your_GUI.ui   >  file_name_of_a_Python_code_to_be_created.py


Note that pyuic6 is for PyQt6.  If you use PyQt5, it should be pyuic5.

You can skip Step 2 and then file name must include PATH (e.g., c:\user\my_GUI.ui)


Dec 19, 2020

[Windows] cmd command that open a new window to run another command

Using a batch file, at times we need to run more than 1 command in a separate window.

To run command in a separate window and close when done,
start cmd /c command

To run command in a separate window and leave it open when done,
start cmd /k command


Mar 1, 2020

convert between GPT and MBR partitions using diskpart


First, run Windows command prompt (cmd) as administrator.
In the cmd console, run "diskpart".  (During Windows installation, shift + F10)


In the "diskpart" command,
to check the type of partition,
        list disk

to select a disk,
        select disk #   (#: disk number)

to convert,
        convert MBR  (convert to MBR partition)
        or
        convert GPT  (convert to GPT partition)

to create a volume,
        create partition primary (size=???)  (if size is missing, the whole size is used as a volume)

to format the created volume,
        (select partition #)
        (active)   (this is for MBR partition)
        format fs=FAT32 (quick)



Oct 13, 2017

How to create a txt file containing a list of all files and sub-folders

In a cmd window,
"dir /b" will list all files and sub-folders in a folder.
To make a list file (list.txt) containing all information that comes after the "dir /b" command,
"dir /b < list.txt"

If you want to list files only,
"dir /a:-d /o:n /b  < list.txt"

If you want to list sub-folders only,
"dir /a:d /o:n /b  < list.txt"


"/o:n" results in an alphabetically sorted list

Reference:
http://blog.daum.net/graphixxx/13631801

Apr 26, 2016

How to remove a browser hijacker (e.g., piesearch.com)

To remove an annoying browser hijacker such as piesearch.com,
(1) Run cmd.exe as administrator
(2) Type following three commands:
      rd /s /q "%WinDir%\System32\GroupPolicyUsers"
      rd /s /q "%WinDir%\System32\GroupPolicy"
      gpupdate /force

This will remove such a browser hijacker from your Chrome web-browser.
If necessary, you might want to do one more step:
      Open Chrome as administrator and then change your default search engine in the setting.

Aug 25, 2015

How to fix problems with recycle bin (Windows 7)

If there are any problems with recycle bin, the easiest and fastest way to fix will be to reset the recycle bin.

1.  run "cmd" as administrator
2.  rd  /s /q  c:\$recycle.bin


Apr 24, 2015

How to input "figures" or "string" using a batch file


example.bat
-----------------------------------------------------------

@echo off
setlocal

set /p str= # of atoms :

echo  # of atoms : %str%

atoms.exe  %str%




May 17, 2012

How to save everything displayed in cmd windows

To save everything in cmd windows as a txt file,

        dir > t.txt

You cannot see anything in the screen, but everything supposed to be displayed saved in t.txt file.
It calls "output redirection".
If you want to print out,
        dir > prn

We can utilize this skill for java with compiled program (e.g., double_data.class).
e.g.,  in cmd windows,
        java  double_data  >  t.txt


May 11, 2011

How to add "Dos prompt (cmd)" to explorer menu

To add "cmd" to explorer menu in Windows 7,
1. start --> run --> regedit  -->  \HKEY_CLASSES_ROOT\Folder\shell
2. make a new key (cmd)
3. make a new key (command) in the created folder (cmd)
4. modify "(Default)" --> value data -->  cmd.exe /k pushd %1