Skip to content

Instantly share code, notes, and snippets.

@splch
Last active September 8, 2021 03:18
Show Gist options
  • Save splch/c8c60345e11ff2320da13d3c94ab2195 to your computer and use it in GitHub Desktop.
Save splch/c8c60345e11ff2320da13d3c94ab2195 to your computer and use it in GitHub Desktop.
Open Windows EXE from Chrome OS File Manager
#!/bin/bash
mkdir -p $HOME/bin/
cat > $HOME/bin/wine-runner.sh <<EOF
#!/bin/bash
NAME=\$(basename \$1 | cut -f 1 -d ".")
echo "Windows Executable: \$NAME.exe"
mkdir -p \$HOME/bin/
cp \$1 \$HOME/bin/ 2>/dev/null
# wrestool -x -t 14 \$1 > \$HOME/.local/share/icons/hicolor/16x16/apps/\$NAME.png
echo "Executable: \$HOME/bin/\$NAME.exe"
# echo "Icon: \$HOME/.local/share/icons/\$NAME.png"
cat > \$HOME/.local/share/applications/\$NAME.desktop <<EOL
[Desktop Entry]
Name=\$NAME
Exec=wine \$HOME/bin/\$NAME.exe
Terminal=false
Type=Application
# Icon=\$NAME.png
EOL
echo "Desktop: \$HOME/.local/share/applications/\$NAME.desktop"
wine \$HOME/bin/\$NAME.exe
EOF
chmod +x $HOME/bin/wine-runner.sh
cat > $HOME/.local/share/applications/wine-runner.desktop <<EOL
[Desktop Entry]
Version=1.0
Type=Application
Name=Wine Runner
Exec=$HOME/bin/wine-runner.sh %u
Terminal=false
MimeType=application/octet-stream;application/x-ms-dos-executable;application/x-msi;application/x-ms-shortcut;
EOL
rm $BASH_SOURCE
@InInfinitumEtInTenebris

Is there a way to modify this to where it works on external storage devices as well?

@splch
Copy link
Author

splch commented Aug 24, 2021

@UnknownAzzwipe Is there a way to modify this to where it works on external storage devices as well?

I think there is... thanks for the feature request. I'll see how other applications access external directories and replicate that functionality. I do know that you'll need to share the external device with linux, though. The next revision to the file will implement this 😄

Update: If you share your folder or external device with linux, you'll be able to install .exe files from that folder.

@InInfinitumEtInTenebris
Copy link

InInfinitumEtInTenebris commented Sep 8, 2021

@UnknownAzzwipe Is there a way to modify this to where it works on external storage devices as well?

I think there is... thanks for the feature request. I'll see how other applications access external directories and replicate that functionality. I do know that you'll need to share the external device with linux, though. The next revision to the file will implement this 😄

Update: If you share your folder or external device with linux, you'll be able to install .exe files from that folder.

Oh thanks. I'm glad my idea was of service.
Edit: I've tried to run exe files on my external storage device with the program just loading on my shelf. I'm not exactly sure why that is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment