Deprecated: Creation of dynamic property Timber\Site::$pingback is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Site.php on line 180

Deprecated: Creation of dynamic property Timber\User::$name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/User.php on line 118

Deprecated: Creation of dynamic property Timber\Post::$old_id is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_thumbnail_id is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$ext-thumbnail_url is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_metadesc is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_date_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$ping_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_password is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$to_ping is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$pinged is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_content_filtered is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$guid is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$menu_order is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_mime_type is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_count is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$filter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71
Eseguire applicazioni Windows dall'ambiente Linux di WSL2

Eseguire applicazioni Windows dall'ambiente Linux di WSL2

Windows 10: WSL2 permette di utilizzare comandi e applicazioni Windows dalla shell Linux.

La scorsa settimana avevamo parlato di WSL2 (Windows Subsystem for Linux), la seconda versione della soluzione integrata in Windows 10 che permette di eseguire le principali distribuzioni Linux direttamente dal sistema operativo Microsoft appoggiandosi alla virtualizzazione Hyper-V: WSL2: avviare le principali distribuzioni Linux anche da Windows 10 release 1909 e 1903.

Con WSL2 i tecnici di Microsoft hanno ulteriormente sfumato i confini tra l’ambiente Linux (che adesso viene virtualizzato anziché ricorrere a un layer di compatibilità come avveniva in passato) e Windows 10.

Dalla shell di WSL2 è infatti ora possibile eseguire anche i programmi Windows presenti sulla macchina e non soltanto comandi e applicazioni Linux.
Per procedere, dopo aver installato e attivato WSL2 sulle versioni di Windows 10 che supportano tale soluzione, basterà richiamare gli eseguibili utilizzati sul sistema operativo Microsoft ricordandosi di specificare sempre l’estensione .exe. Diversamente WSL2 li interpreterà come comandi Linux.

Per avviare ad esempio il Blocco Note, basterà digitare notepad.exe al prompt di WSL2.
Un’operazione simile potrà essere effettuata per tutti i programmi Windows presenti nei percorsi indicati nell’output del comando env | grep "PATH".

Se si volessero eseguire applicazioni fuori dai percorsi indicati, basterà specificarne cartella ed eseguibile. Esempio:

"/mnt/c/program files/"

Dopo program files/ e prima delle doppie virgolette finali, si potranno introdurre nome della cartella ed eseguibile completo di estensione .exe.

Sempre dalla shell di WSL2 è possibile elaborare l’output restituito da comandi Windows. Nell’esempio si usa grep, comando comune ai sistemi Unix e Unix-like, per intervenire su ciò che viene restituito da sc, programma Windows che mostra informazioni sui servizi di sistema installati e sul loro stato:

sc.exe query | grep NOME_SERVIZIO | awk '{print $1=""; print $0}' | sort -bf | sed '/^$/d'

Ti consigliamo anche

Link copiato negli appunti