Compare commits
7 commits
45ad9ea79a
...
dab081eb0b
Author | SHA1 | Date | |
---|---|---|---|
dab081eb0b | |||
f4b47946d9 | |||
e0eb36720b | |||
ef547b7be1 | |||
1baac5aee9 | |||
c1e9bb32ce | |||
0ef8aa01e7 |
8 changed files with 170 additions and 7 deletions
14
README.md
14
README.md
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
# Winure: WSL inurement tools
|
# Winure: WSL inurement tools
|
||||||
|
|
||||||
These are tools I use to use Windows primarily through WSL. A lot of them
|
These are tools I use to use Windows primarily through WSL. Many are
|
||||||
assume you have PowerShell somewhere in your `PATH` as "`pwsh`".
|
cross-dependent.
|
||||||
|
|
||||||
## `dos-var`
|
## `dos-var`
|
||||||
|
|
||||||
|
@ -39,9 +39,17 @@ A feature-barren DOS clone of `ls` that hides Windows hidden files. Relies on
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
|
|
||||||
|
- `cmd.sh`: Simple wrapper for `cmd.exe`.
|
||||||
- `dos.sh`: Simple wrapper for executing Windows commands directly.
|
- `dos.sh`: Simple wrapper for executing Windows commands directly.
|
||||||
- `elevate.sh`: Elevate WSL (`-l`) or Windows (`-w`) commands from WSL.
|
- `elevate.sh`: Elevate WSL (`-l`) or Windows (`-w`) commands from WSL.
|
||||||
- `explorer.sh`: Launch explorer from WSL.
|
- `explorer.sh`: Launch explorer from WSL.
|
||||||
- `pwsh.sh`: Launch PowerShell Core.
|
- `pwsh.sh`: Launch PowerShell Core.
|
||||||
- `terminal.sh`: Launch Windows Terminal.
|
- `wt.sh`: Launch Windows Terminal.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Windows Man Pages
|
||||||
|
|
||||||
|
- `cmd(8)`: `cmd.exe`
|
||||||
|
- `wt(1)`: Windows Terminal
|
||||||
|
|
||||||
|
|
85
man/cmd.8
Normal file
85
man/cmd.8
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
.Dd $Mdocdate$
|
||||||
|
.Dt CMD 8
|
||||||
|
.Os MICROSOFT WINDOWS
|
||||||
|
.Sh NAME
|
||||||
|
.Nm cmd
|
||||||
|
.Nd Windows Command Prompt
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Op Fl DQ
|
||||||
|
.Op Fl A|U
|
||||||
|
.Op Fl C|K Ar command
|
||||||
|
.Op Fl E Ns = Ns Ar ON|OFF
|
||||||
|
.Op Fl T Ns = Ns Ar fb
|
||||||
|
.Op Fl V Ns = Ns Ar ON|OFF
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
is a Linux wrapper for Windows Command Prompt. Its options are as follows:
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Fl A
|
||||||
|
Standard outputs will be redirected in ANSI.
|
||||||
|
.It Fl C Ar command
|
||||||
|
Executes the specified command and exits.
|
||||||
|
.It Fl D
|
||||||
|
Disables autorun commands.
|
||||||
|
.It Fl E Ns = Ns Ar ON|OFF
|
||||||
|
Enable or disable command extensions.
|
||||||
|
.It Fl F Ns = Ns Ar ON|OFF
|
||||||
|
Enable or disable filename completion.
|
||||||
|
.It Fl K Ar command
|
||||||
|
Executes the specified command, then become interactive.
|
||||||
|
.It Fl Q
|
||||||
|
Disables echoing commands for non-interactive modes.
|
||||||
|
.It Fl S
|
||||||
|
(TODO) command string modifier?
|
||||||
|
.It Fl T Ns = Ns Ar fb
|
||||||
|
Output will use colors as if 'color xx' was called; the first digit sets the foreground color, and the second digit sets the background color.
|
||||||
|
.It Fl U
|
||||||
|
Standard outputs will be redirected in Unicode.
|
||||||
|
.It Fl V Ns = Ns Ar ON|OFF
|
||||||
|
Enable or disable execution-time environment variable expansion.
|
||||||
|
.Sh BEHAVIORS
|
||||||
|
.Ss AUTORUN
|
||||||
|
Autorun is enabled by default, and can be disabled with the
|
||||||
|
.Fl D
|
||||||
|
flag. If enabled, the program will search registry variables
|
||||||
|
.Cd HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
|
||||||
|
and
|
||||||
|
.Cd HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
|
||||||
|
for commands at startup and execute them if present.
|
||||||
|
.Ss COMMAND EXTENSIONS
|
||||||
|
Command extensions are enabled by default, and can be disabled by setting
|
||||||
|
.Fl E Ns = Ns OFF .
|
||||||
|
Extensions can modify the following commands:
|
||||||
|
.Pp
|
||||||
|
.Ic DEL or Ic ERASE ,
|
||||||
|
.Ic COLOR ,
|
||||||
|
.Ic CD or Ic CHDIR ,
|
||||||
|
.Ic MD or Ic MKDIR ,
|
||||||
|
.Ic PROMPT ,
|
||||||
|
.Ic PUSHD ,
|
||||||
|
.Ic POPD ,
|
||||||
|
.Ic SET ,
|
||||||
|
.Ic SETLOCAL ,
|
||||||
|
.Ic ENDLOCAL ,
|
||||||
|
.Ic IF ,
|
||||||
|
.Ic FOR ,
|
||||||
|
.Ic CALL ,
|
||||||
|
.Ic SHIFT ,
|
||||||
|
.Ic GOTO ,
|
||||||
|
.Ic START ,
|
||||||
|
.Ic ASSOC ,
|
||||||
|
.Ic FTYPE
|
||||||
|
.Ss EXECUTION-TIME ENVIRONMENT VARIABLE EXPANSION
|
||||||
|
Execution-time environment variable expansion is disabled by default, and can be enabled by setting
|
||||||
|
.Fl V Ns = Ns OFF .
|
||||||
|
If enabled, enclosing a variable name with '!' characters will substitute the variable's value at command execution time.
|
||||||
|
.Ss FILENAME COMPLETION
|
||||||
|
Filename completion is disabled by default, and can be enabled by setting
|
||||||
|
.Fl F Ns = Ns ON .
|
||||||
|
If enabled, Ctrl-D and Ctrl-F can be used for directory and file completion respectively.
|
||||||
|
.Sh BUGS
|
||||||
|
.Nm
|
||||||
|
lacks escape characters, meaning arguments with special characters
|
||||||
|
.Em must
|
||||||
|
be enclosed in quotes.
|
|
@ -3,4 +3,5 @@ alias i := install
|
||||||
|
|
||||||
install DIR="(unused)":
|
install DIR="(unused)":
|
||||||
sudo cp ./*.1 /usr/share/man/man1/
|
sudo cp ./*.1 /usr/share/man/man1/
|
||||||
|
sudo cp ./*.8 /usr/share/man/man8/
|
||||||
|
|
||||||
|
|
|
@ -56,11 +56,11 @@ Windows Explorer does not accept paths with spaces when executed from WSL. To ge
|
||||||
.Pp
|
.Pp
|
||||||
Windows Terminal's executable moves when updated. To generate a script to launch Windows Terminal:
|
Windows Terminal's executable moves when updated. To generate a script to launch Windows Terminal:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl $ mkwin --empty --find='/mnt/c/Program Files/WindowsApps/Microsoft.WindowsTerminal*' WindowsTerminal.exe > terminal.sh
|
.Dl $ mkwin --empty --find='/mnt/c/Program Files/WindowsApps/Microsoft.WindowsTerminal*' WindowsTerminal.exe > wt.sh
|
||||||
.Pp
|
.Pp
|
||||||
PowerShell doesn't inherit environment variables from WSL. To generate a script to call PowerShell with shared variables:
|
PowerShell has two versions (Core is user-installed) and doesn't inherit environment variables from WSL. To generate a script to call PowerShell Core with a fallback to Windows PowerShell and shared environment variables:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl $ mkwin -E '/mnt/c/Program Files/PowerShell/7/pwsh.exe'
|
.Dl $ mkwin -E '/mnt/c/Program Files/PowerShell/7/pwsh.exe' --or '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
|
||||||
.Pp
|
.Pp
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr env-share 1 ,
|
.Xr env-share 1 ,
|
||||||
|
|
47
man/wt.1
Normal file
47
man/wt.1
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
.Dd $Mdocdate$
|
||||||
|
.Dt WT 1
|
||||||
|
.Os MICROSOFT WINDOWS
|
||||||
|
.Sh NAME
|
||||||
|
.Nm wt
|
||||||
|
.Nd Windows Terminal
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Op Fl hv
|
||||||
|
.Op Fl f|F|M
|
||||||
|
.Op Fl -pos Ar x,y
|
||||||
|
.Op Fl -profile Ar name
|
||||||
|
.Op Fl -size Ar c,r
|
||||||
|
.Op Ar commandline
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
is a Linux wrapper for Windows Terminal. Its options are as follows:
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Fl h , Fl -help
|
||||||
|
Opens a dialog displaying help information.
|
||||||
|
.It Fl e
|
||||||
|
Launches the program with administrator privileges.
|
||||||
|
.It Fl f , Fl -focus
|
||||||
|
Launches the program with no title or tab bar.
|
||||||
|
.It Fl F , Fl -fullscreen
|
||||||
|
Launches the program in fullscreen mode. Conflicts with
|
||||||
|
.Fl -maximized .
|
||||||
|
.It Fl M , Fl -maximized
|
||||||
|
Launches the program in a maximized window. Conflicts with
|
||||||
|
.Fl -fullscreen .
|
||||||
|
.It Fl -pos Ar x,y
|
||||||
|
Launches the program at the given screen position.
|
||||||
|
.It Fl -profile Ar name
|
||||||
|
Launches the profile with the given
|
||||||
|
.Ar name
|
||||||
|
.
|
||||||
|
.It Fl -size Ar c,r
|
||||||
|
Launches the program with the given size in columns and rows respectively.
|
||||||
|
.It Fl v , Fl -version
|
||||||
|
Opens a dialog displaying version information.
|
||||||
|
.It Ar commandline
|
||||||
|
Attempt to run the given Windows command as the command line.
|
||||||
|
.El
|
||||||
|
.Sh BUGS
|
||||||
|
The official documentations (online and via
|
||||||
|
.Fl h )
|
||||||
|
contain a variety of errors, including deprecated/unsupported flags, and subcommands, which do not work.
|
21
scripts/cmd.sh
Executable file
21
scripts/cmd.sh
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
if [ "$#" -eq 0 ]; then
|
||||||
|
args=''
|
||||||
|
for arg in $@; do
|
||||||
|
if [[ $arg =~ ^-.+$ ]]; then
|
||||||
|
transform=(${arg//-//})
|
||||||
|
if [[ $arg =~ ^-.+=.+$ ]]; then
|
||||||
|
transform=(${transform//=/:})
|
||||||
|
fi
|
||||||
|
args="$args $transform"
|
||||||
|
else
|
||||||
|
args="$args $arg"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
/mnt/c/Windows/System32/cmd.exe $args
|
||||||
|
else
|
||||||
|
/mnt/c/Windows/System32/cmd.exe
|
||||||
|
fi
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
alias i := install
|
alias i := install
|
||||||
|
|
||||||
install DIR="~/.bin":
|
install DIR="~/.bin":
|
||||||
|
cp cmd.sh {{DIR}}/cmd
|
||||||
cp dos.sh {{DIR}}/dos
|
cp dos.sh {{DIR}}/dos
|
||||||
cp elevate.sh {{DIR}}/elevate
|
cp elevate.sh {{DIR}}/elevate
|
||||||
cp explorer.sh {{DIR}}/explorer
|
cp explorer.sh {{DIR}}/explorer
|
||||||
|
|
|
@ -6,5 +6,5 @@ fi
|
||||||
|
|
||||||
cd '/mnt/c/Program Files/WindowsApps/'
|
cd '/mnt/c/Program Files/WindowsApps/'
|
||||||
target=`find Microsoft.WindowsTerminal* -name 'WindowsTerminal.exe'`
|
target=`find Microsoft.WindowsTerminal* -name 'WindowsTerminal.exe'`
|
||||||
dos "$target"
|
dos "$target" $@
|
||||||
|
|
Loading…
Reference in a new issue