GithubHelp home page GithubHelp logo

josephuspaye / show-properties Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 105 KB

Show the File Explorer properties dialog for a file or folder from Node.js

License: MIT License

Batchfile 16.48% TypeScript 19.31% C++ 64.21%
file-explorer windows nodejs createweekly

show-properties's Introduction

show-properties

A Node.js module for showing the File Explorer properties dialog for a file or folder on Windows.

This project is part of #CreateWeekly, my attempt to create something new publicly every week in 2020.

Why

It's easy to call ShellExecuteEx with the properties verb to show the properties dialog. What's hard is keeping the dialog open without blocking or using hacks like Sleep(). This module solves that problem using a custom executable and a wrapping Node module.

Installation

npm install @josephuspaye/show-properties --save

Usage

const { showProperties } = require('@josephuspaye/show-properties');

// Show the properties dialog for the default local disk
showProperties('C:\\');

// Show the properties dialog for a file
showProperties('C:\\my-file.txt');

// Show the properties dialog for a folder
showProperties('C:\\my-folder');

API

/**
 * Show the Explorer properties dialog for the file or folder at the given path.
 * Returns the exit code of the launcher process (not the launched dialog process).
 */
function showProperties(targetPath: string): Promise<number | null>;

Building the executable

The module uses an executable to launch the properties dialog for the given path. The source of this executable is at src/show-properties.cpp and you can build it as follows:

  • Install an MSVC Compiler. You can get this with windows-build-tools or Visual Studio.
  • Copy the .env.bat.example file to .env.bat and update the variables to match your system
  • Run ./build.bat to build. The resulting executable will be placed at bin/ShowProperties.exe.

Licence

MIT

show-properties's People

Contributors

josephuspaye avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.