Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taviso/minirun
Run commands with hidden console.
https://github.com/taviso/minirun
windows wsl
Last synced: 16 days ago
JSON representation
Run commands with hidden console.
- Host: GitHub
- URL: https://github.com/taviso/minirun
- Owner: taviso
- Created: 2021-01-23T20:03:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-24T15:24:48.000Z (almost 4 years ago)
- Last Synced: 2024-10-24T12:12:51.728Z (21 days ago)
- Topics: windows, wsl
- Language: C
- Homepage:
- Size: 21.5 KB
- Stars: 29
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Minimal run
This is a tiny C program for running Windows commands with a hidden
console. It's suitable for use in Windows shortcuts, i.e. lnk files.I use `run.exe wsl --exec xterm -display :0` to launch an XTerm on Windows.
If you don't want to compile it yourself, check the [Releases](https://github.com/taviso/minirun/releases) section.
# Building
```
> rc.exe /nologo resource.rc
> cl.exe /nologo /Zi /O2 /guard:cf /GF /c /Fo:run.obj run.c
> cl.exe /nologo /Zi /O2 /guard:cf /GF /MT /Fe:run.exe run.obj resource.res /link user32.lib
```> Note: You need to build it as a 64bit application to access wsl.exe.
# Screenshot
You can't see it running because it's designed to be invisible! Your
shortcut should look something like this.![Screenshot](xterm-example.png)
# Troubleshooting
First try this to make sure run is working:
```
run.exe calc
```If that does work, but starting a wsl application doesn't work, it may be a
PATH issue.Try using the full path instead, like this:
```
run.exe wsl --exec /usr/bin/program
```If you need to set `$DISPLAY` or some other variable, use `env`. For example,
like this:```
run.exe wsl --exec env DISPLAY=:0 /usr/bin/program
```Are you trying to run a script? It might be a permissions issue, try this:
```
run.exe wsl --exec /bin/sh /full/path/to/script.sh
```> If it's not a shell script, use the correct interpreter.. e.g. `/usr/bin/perl`.
Are you trying to use `$DISPLAY` in wsl2? You might need a script to get the right address, save this as display.sh
```sh
#!/bin/sh
DISPLAY=$(awk '/nameserver/ {print $2; exit}' /etc/resolv.conf):0 exec "${@}"
```Now you can do `run.exe wsl --exec /bin/sh /path/to/display.sh /usr/bin/xterm`