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

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)



May 22, 2019

add/remove/change start menu folders/icons in Windows 10

To add/remove/change start menu folders/icons in Windows 10,
using "file explorer", move to
%AppData%\Microsoft\Windows\Start Menu\Programs
and/or
%ProgramData%\Microsoft\Windows\Start Menu\Programs

in there, you can manage folders/icons freely.


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.

Dec 17, 2015

initial setup for Cygwin on Windows 7 or later systems

After we install Cygwin (https://cygwin.com/install.html), we encounter many problems such as "xxx command not found".
To prevent such awkward situations from happening, we may want to do some initial setups.

1. PATH
We can check the current PATH by typing "echo $PATH" in Cygwin console.
To set up PATH, open "C:\cygwin64\home\username\.bash_profile" in a text editor.
Add any PATH you want to the section "# Set PATH so it includes user's private bin if it exists".
For example,
# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
   PATH="/bin/:/home/myID/src/:${HOME}/bin"
# fi

($HOME denotes "/home/userID/" under the folder where Cygwin has been installed.  e.g., C:/cygwin64/home/myID/)

If we want to add more than one PATH, we use ":" in between directories.


2. Console (terminal) visibility
On Cygwin console, mouse right-click and select "options".
Go to "text" tab and set font to "Lucia console, 11 point".
Go to "window" tab and set size to 120 columns and 40 rows.  Set scrollback lines to 50000.
It will give more powerful environment for working in the console.


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%




Jul 28, 2014

How to change boot order using Grub (Ubuntu linux 14.04)

After installing Ubuntu 14.04, the default boot entry for Grub is set to "Ubuntu" (the first one in example as below).
e.g.,
Ubuntu
Ubuntu (Recovery mode)
Memory test 1
Memory test 2
Windows 7 (loader)

To change the default boot entry to 'Windows 7',
1. Open 'terminal' in Ubuntu
2. Type "sudo gedit /etc/default/grub"
3. Find a line saying 'GRUB_DEFAULT=0'.  All the entries in the GRUB menu are zero-indexed.
    i.e., the very first entry is indexed as '0' and the last one is indexed as 'n-1'.
4. Because 'Windows 7' is listed at 5th position, it has index '4'.
    Edit the line to 'GRUB_DEFAULT=4', and save the file.
5. To apply the changes, type "sudo update-grub" in terminal


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


Feb 5, 2012

batch file with command line arguments

to create batch file (j.bat),
echo off
javac %1.java
echo run?
pause
java %1

to run the batch file,
j calc
(%1 = calc)

How to add PATH in Windows

control panel --> system --> advanced --> Environment variables --> system variables --> PATH

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

May 10, 2011

how to restart on a remote control computer..

To restart on a remotely controlled computer,
"Ctrl + Alt + End"  -->  Shut down --> Restart

Apr 30, 2011

How to switch screen among multiple monitors..

When using multiple monitors, a window pops up in an unintended monitor.
In Windows 7, monitors can be switched using "Shift + Windows Key + keyboard cursor".


In Ubuntu linux, we can use a script called "swapmonitor".
http://lab.threeword.com/attachment/cfile3.uf@112260574D997C901FE6EB.bz2
We can make a shortcut for it:
System menu --> dafault --> keyboard shortcut


References:
http://ubuntuforums.org/showthread.php?t=284511
http://lab.threeword.com/36