How to chmod +x a file in Windows, for use in Linux?

22,409

Solution 1

The key phrase in your question is "executable upon receipt", and the answer depends on how it's being received. If you send a tarball, you can have some executable files in it. A single file could be mailed in uuencode format with begin 755 filename in the header. If you provide more details on what tools you have available on the sending side, we might be able to find a way to make it work.

Solution 2

chmod +x sets attribute in the filesystem and is not assiciated with the file itself. So, there is no way to do that you want.

Solution 3

git update-index --chmod=+x myfile.sh

from https://www.scivision.dev/git-windows-chmod-executable/

Share:
22,409

Related videos on Youtube

Danny Beckett
Author by

Danny Beckett

I'm a PHP/JS developer & C#/XAML programmer from Liverpool . I lived in Amsterdam for a couple of years, and Oslo for a little while too. OS windows-server centos GUI c# .net wpf visual-studio Web php html5 css3 javascript jquery SQL mysql mssql t-sql oracle pl-sql sybase-asa sqlanywhere HTTPd apache iis

Updated on September 18, 2022

Comments

  • Danny Beckett
    Danny Beckett over 1 year

    I have a file that needs to be executable in Linux, which I'd do by using chmod +x when using Linux.

    My problem is: this file is compiled in Windows, and it's a pain to have to open my Ubuntu VM to just chmod it.

    Is there a tool, or a method in Windows to allow me to add the +x permission to the file, so it is executable upon receipt to a Linux machine?

    I've tried searching SU and Google, but I'm only seeing irrelevant results about how chmod doesn't exist on Windows, and to use file permissions instead - but this isn't what I'm looking for.

    • Frank Nocke
      Frank Nocke over 7 years
      prepending a script see here might be a workaround?
  • Danny Beckett
    Danny Beckett almost 11 years
    I thought of using a tar archive, but my problem is getting it to be +x in the first place. Basically, I do all of my development on a Windows machine. It's a project using Adobe AIR, and in that is a requirement to use the NativeProcess class. In doing so, an exe is launched on Windows, and the binary on Linux. It's that binary that needs to be +x.
  • Danny Beckett
    Danny Beckett almost 11 years
    Actually, it looks like an untar package is available for AIR. I could put the executable in a tar archive, then untar it on installation.
  • Frank Nocke
    Frank Nocke over 7 years
    For tar, look at my old time favourite unxutils (Linux command as .exe's under Windows. No cygwin or similar required.)
  • thisismydesign
    thisismydesign over 5 years
    That isn't entirely true as VCS (e.g. git) keeps track of execution rights.