Difference between revisions of "Windows"

From TheBestLinux.com
Jump to navigation Jump to search
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Microsoft Windows =
 
= Microsoft Windows =
Or as some of us jokingly refer to the OS, Windoze~!
+
Windows is the most popular desktop operating system most people use at home and at work.  There are also "server" versions of MS Windows, which are used at big companies to manage their internal domains and active directory user account management systems, as well as other "server" type functions, even IIS, the Microsoft Internet Information Server to host websites on the Internet and MS SQL database servers, and many more functions I won't go into here.
 +
<br /><br />
  
 
= Info, Tips & Tricks =
 
= Info, Tips & Tricks =
 +
[[windows_cleanup|How to clean up your Windows installation to free up drive space]]
 +
<br /><br />
 +
[[powershell|Windows PowerShell Information]]
 +
<br /><br />
 
[[cmd_tools|Windows command line tools, otherwise known as powerful stuff you can run from the DOS command prompt]]
 
[[cmd_tools|Windows command line tools, otherwise known as powerful stuff you can run from the DOS command prompt]]
 
<br />
 
<br />
 +
<br />
 +
=== The quickest easiest way to open up a DOS command prompt window is to just click the Windows "Start" button, type "cmd"(without the quotes) and hit the ENTER key! ===
 +
<br /><br />
 +
=== '''Command line tools''' ===
 +
==== '''This webpage describes how to customize the Windows command prompt appearance, similar in how the Linux .bashrc file works''' ====
 +
https://ss64.com/nt/prompt.html
  
== As a reminder, the quickest easiest way to open up a DOS command prompt window is to just click the "Start" button, type cmd and hit the ENTER key! ==
+
==== 'Winget - A command line tools to perform software installations from the command line and useful for creation of automation of required applications' ====
 +
The Winget Windows package management tool is very useful for perform installation from the command line or from powershell, as well as used with script for automated installation, configuration, upgrading and removal of many Windows 10 & 11 applications.
  
 +
Here is an example of it's usage to install the Git package for Windows from the command line using Powershell:
 +
<pre style="color:blue">
 +
PS C:\Windows\system32> winget install --id Git.Git -e --source winget
 +
Found Git [Git.Git] Version 2.47.0
 +
This application is licensed to you by its owner.
 +
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
 +
Downloading https://github.com/git-for-windows/git/releases/download/v2.47.0.windows.1/Git-2.47.0-64-bit.exe
 +
  ██████████████████████████████  65.5 MB / 65.5 MB
 +
Successfully verified installer hash
 +
Starting package install...
 +
Successfully installed
 +
PS C:\Windows\system32>
 +
</pre>
 +
<br /><br />
 +
During the installation, a GUI window pops up and displays the status of the installation progress to the end user.  There is no interaction with the GUI pop-up windows. It will close on it's own after installation has completed.  Many other Windows packages can be installed from the command line in a similar way, if the required package is supported by the Winget tool.
 +
<br /><br />
 +
More information about the Winget tool can be found on Microsoft's website, at https://learn.microsoft.com/en-us/windows/package-manager/winget/ .
 +
<br /><br />
 +
More general information can be found on Microsoft's websites, at https://learn.microsoft.com/en-us/windows/package-manager/ .
 +
<br /><br />
 +
 +
=== On Windows 10 systems, there is a "search" field just to the right of the "Start" button, which has a little magnifying glass and says "Type here to search", which is known as "Cortana", where you can type many commands directly into, including the "cmd" command to bring up a DOS type command windows. ===
 +
<br /><br />
 
[[keyboard_shortcuts|Keyboard shortcuts to save you time from taking your hands off the keyboard to use the mouse!]]
 
[[keyboard_shortcuts|Keyboard shortcuts to save you time from taking your hands off the keyboard to use the mouse!]]
 
<br /><br />
 
<br /><br />
 
[[script|Cscript.exe is a command-line version of the Windows Script Host that provides command-line options for setting script properties.]]
 
[[script|Cscript.exe is a command-line version of the Windows Script Host that provides command-line options for setting script properties.]]
<br />
+
<br /><br />
 
[https://technet.microsoft.com/en-us/library/bb490887.aspx/ Excellent information on SCript!]
 
[https://technet.microsoft.com/en-us/library/bb490887.aspx/ Excellent information on SCript!]
<br />
+
<br /><br />
 
There is also the wscript command, which is almost identical to csript, other than it being targeted to running Windows based scripts, whereas cscript is meant to run console based scripts - those which run and complete in a DOS, aka, a command prompt window.
 
There is also the wscript command, which is almost identical to csript, other than it being targeted to running Windows based scripts, whereas cscript is meant to run console based scripts - those which run and complete in a DOS, aka, a command prompt window.
 
<br /><br />
 
<br /><br />
Line 34: Line 69:
 
<br /><br />
 
<br /><br />
 
For more information on these and other Windows scripting and programming, see this excellent site: [https://www.experts-exchange.com/articles/17325/Difference-between-cscript-and-wscript.html Experts Exchange Scripting and Programming]
 
For more information on these and other Windows scripting and programming, see this excellent site: [https://www.experts-exchange.com/articles/17325/Difference-between-cscript-and-wscript.html Experts Exchange Scripting and Programming]
 +
<br />
 +
<br />
 +
How to mount .img files: [https://www.linuxquestions.org/questions/linux-general-1/how-to-mount-img-file-882386/ Mounting .img files]
 
<br />
 
<br />
 
<br />
 
<br />
Line 39: Line 77:
 
<br />
 
<br />
 
<br />
 
<br />
 +
= 'Scripting & Automation' =
 +
== 'Python Language - The Best All-Purpose Language for Scripting & Full-Blown Object-Orientated Programming' ==
 +
Python is the current best all-purpose language for all operating systems.  It can run simple scripts as well as large complex programs!  It is also very easy to learn, and once you grasp the concept of "object-oriented programming", you will be able to create very complex applications!
 +
 +
=== 'Windows Specific Python Information' ===
 +
When Python3, the current version(Python2 is depreciated and rarely used any more), is installed on a Windows machine, certain considerations must be taken into account in order to run Python modules, such as PIP, used to install & manage other Python packages, as you can't just run the pip command from the Windows command line or from powershell.  Here is how to use it to install the "PyWin2" API package, as an example, since it is now a newer requirement for Oracle VirtualBox on Windows hosts if you want to enable and use the built-in Python API bindings.
 +
 +
After installing the main Python 3.x package for Windows, use the following example to use Python PIP to install the PyWin32 API bindings.  Do this from an Administrator enabled command prompt:
 +
<pre style="color:blue">
 +
C:\Windows\system32>py -m pip install pywin32
 +
Collecting pywin32
 +
  Downloading pywin32-308-cp313-cp313-win_amd64.whl.metadata (8.3 kB)
 +
Downloading pywin32-308-cp313-cp313-win_amd64.whl (6.5 MB)
 +
  ---------------------------------------- 6.5/6.5 MB 5.9 MB/s eta 0:00:00
 +
Installing collected packages: pywin32
 +
Successfully installed pywin32-308
 +
 +
C:\Windows\system32>
 +
</pre>
 +
<br /><br />

Latest revision as of 01:51, 20 November 2024

Microsoft Windows

Windows is the most popular desktop operating system most people use at home and at work. There are also "server" versions of MS Windows, which are used at big companies to manage their internal domains and active directory user account management systems, as well as other "server" type functions, even IIS, the Microsoft Internet Information Server to host websites on the Internet and MS SQL database servers, and many more functions I won't go into here.

Info, Tips & Tricks

How to clean up your Windows installation to free up drive space

Windows PowerShell Information

Windows command line tools, otherwise known as powerful stuff you can run from the DOS command prompt

The quickest easiest way to open up a DOS command prompt window is to just click the Windows "Start" button, type "cmd"(without the quotes) and hit the ENTER key!



Command line tools

This webpage describes how to customize the Windows command prompt appearance, similar in how the Linux .bashrc file works

https://ss64.com/nt/prompt.html

'Winget - A command line tools to perform software installations from the command line and useful for creation of automation of required applications'

The Winget Windows package management tool is very useful for perform installation from the command line or from powershell, as well as used with script for automated installation, configuration, upgrading and removal of many Windows 10 & 11 applications.

Here is an example of it's usage to install the Git package for Windows from the command line using Powershell:

PS C:\Windows\system32> winget install --id Git.Git -e --source winget
Found Git [Git.Git] Version 2.47.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://github.com/git-for-windows/git/releases/download/v2.47.0.windows.1/Git-2.47.0-64-bit.exe
  ██████████████████████████████  65.5 MB / 65.5 MB
Successfully verified installer hash
Starting package install...
Successfully installed
PS C:\Windows\system32>



During the installation, a GUI window pops up and displays the status of the installation progress to the end user. There is no interaction with the GUI pop-up windows. It will close on it's own after installation has completed. Many other Windows packages can be installed from the command line in a similar way, if the required package is supported by the Winget tool.

More information about the Winget tool can be found on Microsoft's website, at https://learn.microsoft.com/en-us/windows/package-manager/winget/ .

More general information can be found on Microsoft's websites, at https://learn.microsoft.com/en-us/windows/package-manager/ .

On Windows 10 systems, there is a "search" field just to the right of the "Start" button, which has a little magnifying glass and says "Type here to search", which is known as "Cortana", where you can type many commands directly into, including the "cmd" command to bring up a DOS type command windows.



Keyboard shortcuts to save you time from taking your hands off the keyboard to use the mouse!

Cscript.exe is a command-line version of the Windows Script Host that provides command-line options for setting script properties.

Excellent information on SCript!

There is also the wscript command, which is almost identical to csript, other than it being targeted to running Windows based scripts, whereas cscript is meant to run console based scripts - those which run and complete in a DOS, aka, a command prompt window.

Windows creates a HUGE file over time, which is a database of all of the updates it has done.
The one on my current Windows VM I run on top of my Linux desktop is just over 1GB in size now, which is a large amount for virtual hard drive of only 100GB in size to begin with!
This file is usually located at C:\Windows\SoftwareDistribution\DataStore and is named DataStore.edb.

In order to delete this file to free up the drive space it was hogging, you first need to stop the Update service,
and then just delete the contents of the DataStore folder.
Additionally you should also delete the contents of the Download folder, located at C:\Windows\SoftwareDistribution\Download,
which should free up a lot more drive space!

Then restart the service and run Windows updates again. The file should then get recreated, but it will be a lot smaller to star with, but will grow over time as the previous one had.



For more information on these and other Windows scripting and programming, see this excellent site: Experts Exchange Scripting and Programming

How to mount .img files: Mounting .img files

Windows Server Information, Tips & Tricks

'Scripting & Automation'

'Python Language - The Best All-Purpose Language for Scripting & Full-Blown Object-Orientated Programming'

Python is the current best all-purpose language for all operating systems. It can run simple scripts as well as large complex programs! It is also very easy to learn, and once you grasp the concept of "object-oriented programming", you will be able to create very complex applications!

'Windows Specific Python Information'

When Python3, the current version(Python2 is depreciated and rarely used any more), is installed on a Windows machine, certain considerations must be taken into account in order to run Python modules, such as PIP, used to install & manage other Python packages, as you can't just run the pip command from the Windows command line or from powershell. Here is how to use it to install the "PyWin2" API package, as an example, since it is now a newer requirement for Oracle VirtualBox on Windows hosts if you want to enable and use the built-in Python API bindings.

After installing the main Python 3.x package for Windows, use the following example to use Python PIP to install the PyWin32 API bindings. Do this from an Administrator enabled command prompt:

C:\Windows\system32>py -m pip install pywin32
Collecting pywin32
  Downloading pywin32-308-cp313-cp313-win_amd64.whl.metadata (8.3 kB)
Downloading pywin32-308-cp313-cp313-win_amd64.whl (6.5 MB)
   ---------------------------------------- 6.5/6.5 MB 5.9 MB/s eta 0:00:00
Installing collected packages: pywin32
Successfully installed pywin32-308

C:\Windows\system32>