### Install Nilesoft Shell using Scoop Source: https://github.com/moudey/shell/blob/main/docs/installation.html Run this command in a command prompt to install Nilesoft Shell using Scoop. Ensure the 'extras' bucket is added if you encounter issues. ```shell scoop install nilesoft-shell ``` -------------------------------- ### Install Nilesoft Shell using Windows Package Manager Source: https://github.com/moudey/shell/blob/main/docs/installation.html Run this command in a command prompt to install Nilesoft Shell using the Windows Package Manager. ```shell winget install Nilesoft.Shell ``` -------------------------------- ### str.start Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Checks whether the string starts with the specified prefix. ```APIDOC ## str.start ### Description Checks whether the string starts with the specified prefix. ### Syntax `str.start("Hello World!", "World!")` ``` -------------------------------- ### Get APPX Package Path Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Retrieves the installation path of a specified APPX package. The package name can be a full name or a partial match. ```shell appx.path("WindowsTerminal") // result: // C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.11.3471.0_x64__8wekyb3d8bbwe ``` -------------------------------- ### Find Property: Starts With Matching Source: https://github.com/moudey/shell/blob/main/docs/configuration/properties.html Matches strings that start with the literal string 'foo'. ```plaintext find = 'foo*' ``` -------------------------------- ### Install Nilesoft Shell using Chocolatey Source: https://github.com/moudey/shell/blob/main/docs/installation.html Run this command in an elevated command prompt to install Nilesoft Shell using Chocolatey. Note: A specific version might be required until the package is moderated. ```shell choco install nilesoft.shell ``` -------------------------------- ### Example of New Items in Context Menu Source: https://github.com/moudey/shell/blob/main/docs/configuration/new-items.html Demonstrates the creation of a top-level item, a separator, and a sub-menu with its own item. ```plaintext item(title = 'Hello, World!') separator menu(title = 'sub menu' image = #0000ff) { item(title = 'test sub-item') } ``` -------------------------------- ### appx.version Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Returns the version of an installed application package. ```APIDOC ## appx.version ### Description Returns the version of an installed application package. ### Syntax `appx.version(packageName)` ### Parameters #### Path Parameters - **packageName** (string) - Required - The name or part of the name of the application package. ### Request Example ``` appx.version("WindowsTerminal") ``` ### Response #### Success Response (200) - **version** (string) - The version of the application package. ``` -------------------------------- ### Shell Configuration File Structure Example Source: https://github.com/moudey/shell/blob/main/docs/configuration/index.html Illustrates the general structure of a Shell configuration file, including variable and image declarations, settings, theme, modify, remove, item, separator, and menu definitions. ```shell // variable declaration $variable-name = variable-value //image declaration @image-id = image-value settings { key-name = key-value key-name = [key-value, key-value, ...] ... } theme { key-name = key-value ... } // modify items modify ( property-name = property-value ... ) remove ( property-name = property-value ... ) // new items item ( property-name = property-value ... ) separator [( property-name = property-value ... )] menu ( property-name = property-value ... ) { $variable-name = variable-value item ( property-name = property-value ... ) ... } ``` -------------------------------- ### appx.path Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Returns the file system path of an installed application package. ```APIDOC ## appx.path ### Description Returns the path of an installed application package. ### Syntax `appx.path(packageName)` ### Parameters #### Path Parameters - **packageName** (string) - Required - The name or part of the name of the application package. ### Request Example ``` appx.path("WindowsTerminal") ``` ### Response #### Success Response (200) - **path** (string) - The full file system path to the application package. ``` -------------------------------- ### Find Property: Negated Starts With Word Matching Source: https://github.com/moudey/shell/blob/main/docs/configuration/properties.html Matches strings that do not contain a word starting with 'foo'. ```plaintext find = 'foo!*' ``` -------------------------------- ### Install Nilesoft Shell using Chocolatey (Specific Version) Source: https://github.com/moudey/shell/blob/main/docs/installation.html Use this command to install a specific version of Nilesoft Shell via Chocolatey. Replace '1.8.1' with the desired version number. ```shell choco install nilesoft.shell --version=1.8.1 ``` -------------------------------- ### appx.shell Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Returns the shell command to run an installed application package. ```APIDOC ## appx.shell ### Description Returns the shell command settings to run an installed application package. ### Syntax `appx.shell(packageName)` ### Parameters #### Path Parameters - **packageName** (string) - Required - The name or part of the name of the application package. ### Request Example ``` appx.shell("WindowsTerminal") ``` ### Response #### Success Response (200) - **shell** (string) - The shell command to run the application. ``` -------------------------------- ### Selection Functions: sel.* for Path and File Properties Source: https://context7.com/moudey/shell/llms.txt Provides examples of accessing properties of the currently selected file system object(s), including path details, name, extension, and parent directory. ```nss cmd = command.copy(sel(false, "\n")) // newline-separated ``` ```nss cmd = command.copy(sel(true)) // quoted, space-separated ``` ```nss sel.path // full path: C:\Users\Joe\file.txt ``` ```nss sel.path.quote // quoted path: "C:\Users\Joe\file.txt" ``` ```nss sel.path.name // name no ext: file ``` ```nss sel.parent // parent directory: C:\Users\Joe ``` ```nss sel.parent.quote // quoted parent: "C:\Users\Joe" ``` ```nss sel.name // name + ext: file.txt ``` ```nss sel.file.ext // extension: .txt ``` ```nss sel.file.title // name without ext: file ``` ```nss sel.short // short (8.3) path ``` ```nss sel.root // root drive: C:\ ``` ```nss sel.curdir // working directory ``` ```nss sel.count // number of selected items → integer ``` ```nss sel.back // true if right-clicked on background ``` ```nss sel.readonly(0) // true if first item is read-only ``` ```nss sel.hidden(0) // true if first item is hidden ``` ```nss sel.get(2) // path of 3rd selected item (0-based) ``` ```nss sel.length(0) // path length of first item ``` ```nss title = 'Size: ' + sel.meta('System.Size') ``` ```nss title = 'Author: ' + sel.meta('System.Author') ``` ```nss where = path.exists(sel.lnk) ``` ```nss cmd = sel.lnk // launch the .lnk target ``` -------------------------------- ### appx.name Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Returns the display name of an installed application package. ```APIDOC ## appx.name ### Description Returns the display name of an installed application package. ### Syntax `appx.name(packageName)` ### Parameters #### Path Parameters - **packageName** (string) - Required - The name or part of the name of the application package. ### Request Example ``` appx.name("WindowsTerminal") ``` ### Response #### Success Response (200) - **name** (string) - The display name of the application. ``` -------------------------------- ### Basic Expression Syntax Examples Source: https://context7.com/moudey/shell/llms.txt Demonstrates direct variable references, inline block expressions with operators, and conditional logic using if(). ```nss title = sel.path.name ``` ```nss title = @('Size: ' + sel.meta('System.Size') + ' bytes') ``` ```nss vis = @(if(sel.count > 1, normal, hidden)) ``` ```nss where = @(sel.path.length > 3 && sel.count >= 2) ``` ```nss where = @(sel.file.ext == '.pdf' || sel.file.ext == '.docx') ``` ```nss args = '-d ' + sel.parent.quote + ' --new-window' ``` -------------------------------- ### sel.meta() Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Gets meta data by property key. ```APIDOC ## sel.meta() ### Description Gets meta data for a selected item using a property key. ### Parameters - **property key** (string) - The key of the property to retrieve meta data for. Example: `"System.Size"`. ### Examples ``` sel.meta("System.Size") ``` ``` -------------------------------- ### Modify and Remove Menu Items Source: https://github.com/moudey/shell/blob/main/docs/configuration/modify-items.html Example demonstrating how to modify existing menu items by changing their image property and remove an item. ```configuration modify(find = 'copy' image = #00ff00) modify(find = 'paste' image = #0000ff) remove(find = '"format"') ``` -------------------------------- ### Check if String Starts With Prefix Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Verifies if a string begins with a specified prefix. This is a case-sensitive comparison. ```string str.start("Hello World!", "World!") ``` -------------------------------- ### Silent Installation/Operation Source: https://github.com/moudey/shell/blob/main/docs/installation.html Prevents displaying messages during installation or operation. ```shell shell -silent ``` -------------------------------- ### Install Nilesoft Shell (Portable Mode) Source: https://github.com/moudey/shell/blob/main/docs/installation.html Use this command in an elevated command prompt after extracting the portable version to register it and restart Windows File Explorer. ```shell shell -register -restart ``` -------------------------------- ### Get Directory Name Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the name of the selected item, if it is a directory. ```shell sel.directory.name ``` -------------------------------- ### appx.family Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Returns the family name of an installed application package. ```APIDOC ## appx.family ### Description Returns the family name of an installed application package. ### Syntax `appx.family(packageName)` ### Parameters #### Path Parameters - **packageName** (string) - Required - The name or part of the name of the application package. ### Request Example ``` appx.family("WindowsTerminal") ``` ### Response #### Success Response (200) - **family** (string) - The family name of the application package. ``` -------------------------------- ### Get String Length Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Returns the total number of characters in a string. ```string str.length("Hello World!") ``` -------------------------------- ### appx.id Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Returns the full unique identifier of an installed application package. ```APIDOC ## appx.id ### Description Returns the full unique identifier of an installed application package. ### Syntax `appx.id(packageName)` ### Parameters #### Path Parameters - **packageName** (string) - Required - The name or part of the name of the application package. ### Request Example ``` appx.id("WindowsTerminal") ``` ### Response #### Success Response (200) - **id** (string) - The full unique identifier of the application package. ``` -------------------------------- ### Get Raw Path Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the path of the selected item in its raw, unformatted state. ```shell sel.raw ``` -------------------------------- ### Create a simple taskbar item Source: https://github.com/moudey/shell/blob/main/docs/examples/taskbar.html Defines a basic taskbar item that displays 'Hello World!' and executes a message command. ```Shell $hello_world = 'Hello World!' item(title=hello_world cmd=msg(hello_world)) ``` -------------------------------- ### Get Known Folder Path Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Retrieves the absolute path of a system-defined known folder using its GUID. ```javascript path.getknownfolder('{905e63b6-c1bf-494e-b29c-65b732d3d21a}') ``` -------------------------------- ### Get File Name Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the name (including extension) of the selected item, if it is a file. ```shell sel.file.name ``` -------------------------------- ### Get Path from Shortcut Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Retrieves the target path from a shortcut file (.lnk). ```javascript path.lnk(path) ``` -------------------------------- ### Get Shortcut Type Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the type of the shortcut target (e.g., file, directory). ```shell sel.lnk.type ``` -------------------------------- ### Get File Path Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the path of the selected item, specifically if it is a file. ```shell sel.file ``` -------------------------------- ### System Functions: sys.* for OS and Environment Source: https://context7.com/moudey/shell/llms.txt Demonstrates how to query operating system properties, detect OS versions, access well-known Windows paths, and retrieve environment variables. ```nss where = sys.is11 // true on Windows 11 ``` ```nss where = sys.is10 // true on Windows 10 ``` ```nss where = sys.dark // true if dark mode enabled ``` ```nss sys.type == 64 // true on 64-bit OS ``` ```nss sys.version // e.g. "10.0.22631" ``` ```nss sys.version.major // 10 ``` ```nss sys.version.build // 22631 ``` ```nss sys.version.name // "Windows 11" ``` ```nss sys // %WINDIR% → C:\Windows ``` ```nss sys.root // %SYSTEMDRIVE% → C: ``` ```nss sys.bin // %WINDIR%\system32 ``` ```nss sys.bin32 // %WINDIR%\SysWOW64 ``` ```nss sys.prog // %PROGRAMFILES% ``` ```nss sys.prog32 // %PROGRAMFILES(X86)% ``` ```nss sys.appdata // %APPDATA% ``` ```nss sys.temp // %TEMP% ``` ```nss sys.programdata // %PROGRAMDATA% ``` ```nss cmd = sys.var('EDITOR') + ' ' + sel.path.quote ``` ```nss title = sys.datetime // 2024.06.15-14.30.00 ``` ```nss title = sys.datetime.date // 2024.06.15 ``` ```nss title = sys.datetime.year // 2024 ``` ```nss title = sys.datetime("y/m/d h:M P") // 2024/06/15 02:30 PM ``` ```nss title = datetime("H.M.S.s") // 14.30.00.123 ``` ```nss where = sys.extended // true if Shift key held during right-click ``` ```nss sys.langid // Windows language ID integer ``` -------------------------------- ### Get Meta Data Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Gets meta data for a file using a property key. ```APIDOC ## io.meta ### Description Gets meta data by property key. ### Syntax `io.meta(path, propertyKey)` ### Example ```APIDOC io.meta('path\to\file', "System.Size") ``` ``` -------------------------------- ### Create a 'Hello, World!' Menu Item in Shell Source: https://github.com/moudey/shell/blob/main/docs/get-started.html Add a simple 'Hello, World!' menu item to your context menu. This is the first step in customizing Shell menus. ```shell item(title='Hello, World!' cmd=msg('Hello @user.name')) ``` -------------------------------- ### Nilesoft Shell: Single Item Entry Source: https://context7.com/moudey/shell/llms.txt Defines a single clickable menu entry. Requires a `title` or `image`. This example creates an item to open the selected text file in Notepad, specifying the file type, selection mode, matching extensions, command, arguments, and tooltip. ```nss // item syntax item( title = value [property = value [...]] ) // Single item: open Notepad with the selected file item( title = 'Edit in Notepad' image = 'notepad.exe' // icon from exe type = 'file' // show only for files mode = 'single' // single selection only find = '.txt|.log|.ini|.cfg' // match these extensions cmd = 'notepad.exe' args = sel.path.quote // passes "C:\path\to\file.txt" admin = false window = show wait = false tip = ['Open the selected text file in Notepad', tip.info] ) ``` -------------------------------- ### Get Name with Extension Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the full name of the selected item, including its file extension. ```shell sel.name ``` -------------------------------- ### Generate GUID Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Generates a Globally Unique Identifier (GUID) string. Different formats can be generated based on the provided argument. ```string str.guid ``` ```string str.guid(1) ``` ```string str.guid(2) ``` ```string str.guid(3) ``` -------------------------------- ### Create Directory Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Creates a new directory at the specified path. ```javascript io.directory.create(path) ``` -------------------------------- ### Get Shortcut Target Path Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the target file or directory path from a selected shortcut (.lnk) file. ```shell sel.lnk ``` -------------------------------- ### Get Path Length Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the number of characters in the full path of the selected item. ```shell sel.path.length ``` -------------------------------- ### Create a taskbar item with arguments Source: https://github.com/moudey/shell/blob/main/docs/examples/taskbar.html Creates a taskbar item that opens a command prompt and echoes a variable. ```Shell separator item(title='Command prompt' cmd args='/k echo @hello_world') ``` -------------------------------- ### Nilesoft Shell: Hello World Item Source: https://context7.com/moudey/shell/llms.txt The minimal configuration to add a 'Hello, World!' item to the context menu. Save this in `shell.nss` and reload Nilesoft Shell by holding Ctrl+right-click on the desktop. ```nss // shell.nss — Hello World item item(title='Hello, World!' cmd=msg('Hello @user.name')) ``` -------------------------------- ### Launching Commands with `cmd`, `args`, `admin`, and `window` Source: https://context7.com/moudey/shell/llms.txt Configure how commands are executed using `cmd`, `args`, `admin` for UAC elevation, and `window` to control visibility. `wait` determines if the script should block until completion. ```nss // Open selected folder in Windows Terminal as admin item( title = 'Open Terminal (Admin)' type = 'back.directory|dir' mode = 'multiple' image = \uE756 cmd = 'wt.exe' args = '-d ' + sel.parent.quote admin = true window = show wait = false ) ``` ```nss // invoke=1 → execute once PER selected item item( title = 'Compress each file' type = 'file' mode = 'multiple' invoke = 1 // called once per item cmd = '7z.exe' args = 'a ' + quote(sel.path + '.zip') + ' ' + sel.path.quote window = hidden wait = true ) ``` ```nss // verb: open properties dialog for selected item item(title='Properties' image=\uE115 verb=properties) ``` ```nss // verb=runas — UAC elevation prompt item(title='Run as admin' type='file' find='.exe' verb=runas) ``` -------------------------------- ### Get File Name Length Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the number of characters in the name of the selected item, if it is a file. ```shell sel.file.name.length ``` -------------------------------- ### Get Shortcut Icon Path and Index Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Retrieves the icon path and index associated with a shortcut file. ```javascript path.lnk.icon(path) ``` -------------------------------- ### Get Shortcut Icon Path and Index Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the path to the icon file used by the shortcut, along with its index within that file. ```shell sel.lnk.icon ``` -------------------------------- ### Create File Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Creates a new file at the specified path. Optionally, initial content can be provided. ```javascript io.file.create(path) io.file.create(path, "Hello World!") ``` -------------------------------- ### Get Short Path Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves a shortened version of the selected item's path. Useful for brevity in output. ```shell sel.short ``` -------------------------------- ### Get Short Path Length Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the number of characters in the short path of the selected item. ```shell sel.short.length ``` -------------------------------- ### Get Path of Selected Item Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the full path of the selected file system object. ```shell sel.path ``` -------------------------------- ### str.length (str.len) Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Gets the number of characters in the current string. ```APIDOC ## str.length (str.len) ### Description Gets the number of characters in the current string. ### Syntax `str.length("Hello World!")` ``` -------------------------------- ### Displaying a Message Box with a Title Source: https://github.com/moudey/shell/blob/main/docs/functions/msg.html This example shows how to display a message box with a custom title. If no title is provided, 'NileSoft Shell' is used by default. ```shell msg("Hello, Warld!", "NileSoft Shell") ``` -------------------------------- ### Nilesoft Shell: Menu Entry (Submenus) Source: https://context7.com/moudey/shell/llms.txt Creates a nested submenu. Accepts the same validation/appearance properties as `item`, plus child `item`, `menu`, `separator`, and `import` entries. This example demonstrates an 'Open With' submenu for executable files, including options for Notepad, WordPad, and VS Code, with conditional display for VS Code. ```nss menu( title = value [property = value [...]] ) { [ item() [...] ] [ menu(){} [...] ] [ separator [...] ] [ import 'path/to/file.nss' [...] ] } // Example: "Open With" submenu limited to executables menu(title='Open With' image=\uE14A type='file' mode='multiple') { item(title='Notepad' image=inherit cmd='notepad.exe' args=sel.path.quote) item(title='WordPad' image=inherit cmd='wordpad.exe' args=sel.path.quote) separator item(title='VS Code' image = 'code.exe' where = path.exists(sys.prog + '\Microsoft VS Code\code.exe') cmd = sys.prog + '\Microsoft VS Code\code.exe' args = sel.path.quote) } ``` -------------------------------- ### Get Meta Data Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves meta data for a selected item using a property key. Refer to the provided link for available properties. ```shell sel.meta("System.Size") ``` -------------------------------- ### Get Shortcut Type Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Determines the type of a shortcut file. ```javascript path.lnk.type(path) ``` -------------------------------- ### Get Username Source: https://github.com/moudey/shell/blob/main/docs/functions/user.html Retrieves the current username of the logged-in user. ```APIDOC ## user.name ### Description Returns the current username. ### Syntax `user.name` ``` -------------------------------- ### Create File Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Creates a new file with optional initial content. ```APIDOC ## io.file.create ### Description Create new file with content option. ### Syntax `io.file.create(path)` `io.file.create(path, content)` ``` -------------------------------- ### str.sub Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Copies a substring from a string starting at a specified position. ```APIDOC ## str.sub ### Description Copies a substring of at most some number of characters from a string beginning from a specified position. ### Syntax `str.sub("Hello World!", 5)` `str.sub("Hello World!", 0, 5)` ``` -------------------------------- ### Create, Write, and Append to Files Source: https://context7.com/moudey/shell/llms.txt Create a new file with initial content, overwrite an existing file, or append content to the end of a file. ```nss // Write / append io.file.create('C:\\log.txt', 'created ' + sys.datetime) io.file.write('C:\\log.txt', 'overwritten') io.file.append('C:\\log.txt', 'entry: ' + sel.path + '\n') ``` -------------------------------- ### str.guid Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Returns a new GUID string in various formats. ```APIDOC ## str.guid ### Description Returns a new guid string. ### Syntax `str.guid` return 00000000000000000000000000000000 `str.guid(1)` return 00000000-0000-0000-0000-000000000000 `str.guid(2)` return {00000000-0000-0000-0000-000000000000} `str.guid(3)` return (00000000-0000-0000-0000-000000000000) ``` -------------------------------- ### sel.lnk Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Return the target file/dir path from the selected shortcut. ```APIDOC ## sel.lnk ### Description Returns the target file or directory path from a selected shortcut. ### Examples ``` sel.lnk ``` ``` -------------------------------- ### Get Root Path Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Returns the root directory of a given path, such as 'C:\' for a path on the C drive. This is equivalent to path.root. ```javascript path.root(path) ``` -------------------------------- ### Basic Settings Configuration Source: https://github.com/moudey/shell/blob/main/docs/configuration/settings.html Defines the basic structure for settings, including show delay and tip display. ```plaintext settings { // show menu delay value from 0 to 4000 showdelay = 200 tip = true } ``` -------------------------------- ### Get APPX Package Shell Settings Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Retrieves the shell execution settings for a specified APPX package. The package name can be a full name or a partial match. ```shell appx.shell("WindowsTerminal") // result: // shell:appsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App ``` -------------------------------- ### Configure Favorite Applications and Directories Source: https://github.com/moudey/shell/blob/main/docs/examples/favorites.html Define a menu structure for favorites, including application shortcuts and directory links. Use system variables like user.downloads and sys.directory for easy access. ```menu menu(type='desktop|taskbar' title='Favorites' image=#00ff00) { menu(title='Applications' image=#ff0000) { item(title='Command prompt' image cmd='cmd.exe') item(title='PowerShell' image cmd='powershell.exe') item(title='Registry editor' image cmd='regedit.exe') separator item(title='Paint' image cmd='mspaint.exe') item(title='Notepad' image cmd='notepad.exe') } separator menu(title='Directories' image=#0000ff) { item(title='Downloads' cmd=user.downloads) item(title='Pictures' cmd=user.pictures) item(title='Home' cmd=user.directory) separator item(title='Windows' cmd=sys.directory) item(title='Program files' cmd=sys.prog()) } } ``` -------------------------------- ### Shell Single-line Comment Before Code Source: https://github.com/moudey/shell/blob/main/docs/expressions/comments.html Use single-line comments starting with '//' to explain code that follows. Text after '//' until the end of the line is ignored. ```shell dynamic { // This is a comment item(title='Hello World!') //item(title='Hello World!') } ``` -------------------------------- ### Create a taskbar menu with sub-items Source: https://github.com/moudey/shell/blob/main/docs/examples/taskbar.html Defines a taskbar menu with sub-items to open Paint and Notepad, passing the selected path as an argument. ```Shell separator menu(title='Sub menu') { item(title='Open Paint' cmd='paint.exe' arg=sel.path) separator item(title='Open Notepad' cmd='notepad.exe' arg='"@sel.path"') } ``` -------------------------------- ### path.lnk Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Return a path from the shortcut. ```APIDOC ## path.lnk ### Description Return a path from the shortcut. ### Syntax `path.lnk(path)` ``` -------------------------------- ### app.cfg Source: https://github.com/moudey/shell/blob/main/docs/functions/app.html Returns the path of the configuration file. ```APIDOC ## app.cfg ### Description Returns the path of the configuration file `shell.nss` (or `shell.shl` in older installations). ### Syntax ``` app.cfg '@app.cfg' ``` ``` -------------------------------- ### Get File Size Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Retrieves the size of the specified file in bytes. ```APIDOC ## io.file.size ### Description Retrieves the size of the specified file, in bytes. ### Syntax `io.file.size(path)` ``` -------------------------------- ### Get APPX Package Version Source: https://github.com/moudey/shell/blob/main/docs/functions/appx.html Retrieves the version number of a specified APPX package. The package name can be a full name or a partial match. ```shell appx.version("WindowsTerminal") // result: // 1.11.3471.0 ``` -------------------------------- ### Get File Size Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Retrieves the size of a specified file in bytes. ```javascript io.file.size(path) ``` -------------------------------- ### Get Files with Filtering Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Retrieves files and/or directories from a specified path with optional filtering and flags. Flags control what is returned (files, dirs, full path, etc.). ```javascript path.files(sys.dir, ["*"]) ``` ```javascript path.files(sys.dir, "*.exe") ``` ```javascript path.files(sys.dir, '*', 8|16) ``` -------------------------------- ### app.about Source: https://github.com/moudey/shell/blob/main/docs/functions/app.html Returns Shell information. ```APIDOC ## app.about ### Description Returns Shell information. ### Syntax ``` app.about '@app.about' ``` ``` -------------------------------- ### command.navigate Source: https://github.com/moudey/shell/blob/main/docs/functions/command.html Opens a specified folder path in the same explorer window. ```APIDOC ## command.navigate(path) ### Description Opens a folder in the same explorer window. ### Syntax `command.navigate(path)` ``` -------------------------------- ### Get Shortcut Directory Path Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Extracts the directory path from a shortcut file. ```javascript path.lnk.dir(path) ``` -------------------------------- ### Basic Theme Configuration Source: https://github.com/moudey/shell/blob/main/docs/configuration/themes.html Set the theme name, view mode, and dark mode preference. ```hcl theme { // theme.name = auto, classic, white, black, or modern name = "modern" // view = auto, compact, small, medium, large, wide view = view.compact // dark = true, false, default dark = default } ``` -------------------------------- ### Handle Theme Colors for Canary Builds Source: https://github.com/moudey/shell/blob/main/Issue700-Fix.md Implements special handling for Windows 11 Canary and Dev builds to ensure correct theme colors are applied. Includes fallbacks to system colors when theme APIs fail. ```cpp // Special handling for Windows 11 Canary and Dev builds bool isCanaryOrDev = ver->IsWindows11CanaryOrDev(); // Use more reliable theme color detection for Canary builds if (isCanaryOrDev) { // Get text colors with fallbacks to system colors if (!get_clr(nor, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR)) { nor.from(::GetSysColor(COLOR_MENUTEXT), 100); } // ... similar fallbacks for other colors } ``` -------------------------------- ### Get Shortcut Directory Path Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the directory path of the shortcut file itself. ```shell sel.lnk.dir ``` -------------------------------- ### app.is64 Source: https://github.com/moudey/shell/blob/main/docs/functions/app.html Returns the architecture of the application. ```APIDOC ## app.is64 ### Description Returns the architecture of the application. ### Syntax ``` app.is64 '@app.is64' ``` ``` -------------------------------- ### Get Directory Path Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the path of the selected item, specifically if it is a directory. ```shell sel.directory ``` -------------------------------- ### Navigate to Folder Source: https://github.com/moudey/shell/blob/main/docs/functions/command.html Opens a specified folder path in the current explorer window. Ensure the path is valid. ```shell command.navigate(path) ``` -------------------------------- ### Create Directory Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Creates a new directory. ```APIDOC ## io.directory.create (io.dir.create) ### Description Create new directory. ### Syntax `io.directory.create(path)` ``` -------------------------------- ### Get File Extension Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the file extension of the selected item, if it is a file. ```shell sel.file.ext ``` -------------------------------- ### str.padding Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Returns a new string padded at the start and end with specified characters. ```APIDOC ## str.padding ### Description Returns a new string of a specified length in which the start and end of the current string is padded with spaces or with a specified character. ### Syntax `str.padding("Hello World!", "*")` `str.padding("Hello World!", "*", 3)` ``` -------------------------------- ### Importing an Entire Section in Shell Configuration Source: https://github.com/moudey/shell/blob/main/docs/configuration/index.html Shows how to import an entire configuration section from another file using the 'import' tag. The content of the specified path is inserted into a new section. ```shell // import an entire section import %path% ``` -------------------------------- ### Get Path by Index Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the path of a selected item using its zero-based index. ```shell sel.get(index=`0`) ``` -------------------------------- ### Declare and Use Shell Variables Source: https://github.com/moudey/shell/blob/main/docs/expressions/variables.html Demonstrates declaring string and numeric variables, and then using them in commands and menu structures. Variables can be global or local to a menu block. ```shell $hello_world = 'Hello World!' $test_add1 = 5 + 6 item(title = hello_world cmd = msg(hello_world)) menu(title = test_add1) { $test_sub1 = 11 - 5 item(title = test_sub1) } ``` -------------------------------- ### Get Current Working Directory Path Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the path of the current working directory. ```shell sel.curdir ``` ```shell sel.workdir ``` -------------------------------- ### sel.lnk.icon Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Return a icon path and index from the shortcut. ```APIDOC ## sel.lnk.icon ### Description Returns the icon path and index from a selected shortcut. ### Examples ``` sel.lnk.icon ``` ``` -------------------------------- ### Get Parent Directory Name Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves only the name of the parent directory of the selected item. ```shell sel.parent.name ``` -------------------------------- ### Get Parent Directory Path Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the path of the directory containing the selected item. ```shell sel.parent ``` -------------------------------- ### sel.lnk.dir Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Return a dir path from the shortcut. ```APIDOC ## sel.lnk.dir ### Description Returns the directory path from a selected shortcut. ### Examples ``` sel.lnk.dir ``` ``` -------------------------------- ### Get Root Directory Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Extracts and returns the root directory from the path of the selected item(s). ```shell sel.root ``` -------------------------------- ### Copy Path Menu Configuration Source: https://github.com/moudey/shell/blob/main/docs/examples/copy-path.html Configures a context menu for files and directories to copy their paths to the clipboard. Supports single and multiple selections, with options for full path, short path, parent directory, and file name. ```menu menu(type='file|dir|back|root|namespace' mode="multiple" title='copy to clipboard' image=#ff00ff) { // Appears only when multiple selections. item(vis=@(sel.count > 1) title='Copy path (@sel.count) items selected' cmd=command.copy(sel(false, "\n"))) item(mode="single" title=sel.path cmd=command.copy(sel.path)) item(mode="single" type='file|dir|back.dir' vis=sel.short.len!=sel.path.len title=sel.short cmd=command.copy(sel.short)) separator item(mode="single" vis=@(sel.parent.len>3) title=sel.parent cmd=command.copy(sel.parent)) separator item(mode="single" type='file|dir|back.dir' title=sel.file.name cmd=command.copy(sel.file.name)) item(mode="single" type='file' title=sel.file.title cmd=command.copy(sel.file.title)) item(mode="single" type='file' title=sel.file.ext cmd=command.copy(sel.file.ext)) } ``` -------------------------------- ### Directory Operations Source: https://context7.com/moudey/shell/llms.txt Create new directories and check for their existence or if they are empty. ```nss // Directory operations io.directory.create('C:\\new-folder') where = io.directory.exists(sel.parent) where = io.directory.empty(sel.path) ``` -------------------------------- ### File Date/Time Operations Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Gets or sets the creation, modification, or access time of a file. ```APIDOC ## io.datetime ### Description Gets or Sets the time of the file. ### Get Date Time `io.datetime.created(path)` `io.datetime.modified(path)` `io.datetime.accessed(path)` `io.datetime.created(path, format)` `io.datetime.modified(path, format)` `io.datetime.accessed(path, format)` ### Set Date Time `io.datetime.created(path, year, month, day)` `io.datetime.modified(path, year, month, day)` `io.datetime.accessed(path, year, month, day)` ``` -------------------------------- ### app.version Source: https://github.com/moudey/shell/blob/main/docs/functions/app.html Returns the Shell version. ```APIDOC ## app.version ### Description Returns the Shell version. ### Syntax ``` app.version '@app.version' ``` ``` -------------------------------- ### Get File Metadata Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Retrieves specific metadata for a file using a property key. ```javascript io.meta('path\to\file',"System.Size") ``` -------------------------------- ### User Directory Paths Source: https://github.com/moudey/shell/blob/main/docs/functions/user.html Provides functions to get the paths for various user-specific directories. ```APIDOC ## User Directory Functions ### Description Functions to return the path of user directories. ### Syntax ``` user.home user.appdata user.contacts user.desktop user.directory (user.dir) user.documents user.documentslibrary user.downloads user.favorites user.libraries user.localappdata user.music user.personal user.pictures user.profile user.quicklaunch user.sendto user.startmenu user.temp user.templates user.videos ``` ``` -------------------------------- ### sel.lnk.type Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Return type the shortcut. ```APIDOC ## sel.lnk.type ### Description Returns the type of the selected shortcut. ### Examples ``` sel.lnk.type ``` ``` -------------------------------- ### Get Character at Index Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Retrieves a character from a specific position within a string. The index is zero-based. ```string str.get("Hello World!", 7) ``` -------------------------------- ### path.lnk.type Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Return type from the shortcut. ```APIDOC ## path.lnk.type ### Description Return type from the shortcut. ### Syntax `path.lnk.type(path)` ``` -------------------------------- ### Get Directory Path Length Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the number of characters in the path of the selected item, if it is a directory. ```shell sel.directory.length ``` -------------------------------- ### Detailed Tip Settings Configuration Source: https://github.com/moudey/shell/blob/main/docs/configuration/settings.html Customizes the appearance and behavior of tips, including colors, size, opacity, and time. ```plaintext tip { enabled = true // normal = [background, text] normal = [default, default] // normal = [background, text] primary = [#000, #fff] // info = [background, text] info = [#88f, #fff] // success = [background, text] success = [#8f8, #fff] // warning = [background, text] warning = [#ff8, #fff] // danger = [background, text] danger = [#f88, #fff] // max width value from 200 to 2000 width = 400 // opacity value from 0 to 100 opacity = 100 // radius size value from 0 to 3 radius = 1 time = 1.5 padding = [8, 4] } ``` -------------------------------- ### Get Title Length Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the number of characters in the name of the selected item, excluding the extension. ```shell sel.title.length ``` -------------------------------- ### Goto Navigation Menu for System Folders and Settings Source: https://context7.com/moudey/shell/llms.txt This menu provides quick access to common system folders and Windows Settings pages. It uses nested menus to organize navigation options. ```nss menu(mode="multiple" title='Goto' sep="both" image=\uE14A) { menu(title='Folder' image=\uE1F4) { item(title='Windows' image=inherit cmd=sys.dir) item(title='System32' image=inherit cmd=sys.bin) item(title='Program Files' image=inherit cmd=sys.prog) item(title='Program Files x86' image=inherit cmd=sys.prog32) item(title='ProgramData' image=inherit cmd=sys.programdata) item(title='Users' image=inherit cmd=sys.users) separator item(title='Desktop' image=inherit cmd=user.desktop) item(title='Downloads' image=inherit cmd=user.downloads) item(title='Documents' image=inherit cmd=user.documents) item(title='Pictures' image=inherit cmd=user.pictures) item(title='AppData' image=inherit cmd=user.appdata) item(title='Temp' image=inherit cmd=user.temp) } item(title='Control Panel' image=\uE0F3 cmd='shell:::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}') item(title='Run' image=\uE14B cmd='shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}') menu(title='Settings' sep="before" image=\uE115) { item(title='About' image=inherit cmd='ms-settings:about') item(title='Windows Update' image=inherit cmd='ms-settings:windowsupdate') item(title='Apps & Features' image=inherit cmd='ms-settings:appsfeatures') item(title='Network Status' image=inherit cmd='ms-settings:network-status') item(title='Personalization' image=inherit cmd='ms-settings:personalization-background') item(title='Default Apps' image=inherit cmd='ms-settings:defaultapps') item(title='Windows Defender' image=inherit cmd='ms-settings:windowsdefender') } } ``` -------------------------------- ### path.lnk.icon Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Return a icon path and index from the shortcut. ```APIDOC ## path.lnk.icon ### Description Return a icon path and index from the shortcut. ### Syntax `path.lnk.icon(path)` ``` -------------------------------- ### Get Name Length Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the number of characters in the name (including extension) of the selected item. ```shell sel.name.length ``` -------------------------------- ### path.lnk.dir Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Return a dir path from the shortcut. ```APIDOC ## path.lnk.dir ### Description Return a dir path from the shortcut. ### Syntax `path.lnk.dir(path)` ``` -------------------------------- ### Get Raw Path Length Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the number of characters in the raw path of the selected item. ```shell sel.raw.length ``` -------------------------------- ### str.trimstart Source: https://github.com/moudey/shell/blob/main/docs/functions/str.html Returns a new string with leading specified characters removed. ```APIDOC ## str.trimstart ### Description Returns a new string in which all leading occurrences of a set of specified characters from the current string are removed. ### Syntax Removes all leading white-space characters from the current string. `str.trimstart(" Hello World!")` Removes all leading 'H' characters from the current string. `str.trimstart("Hello World!", "H")` ``` -------------------------------- ### Menu Syntax for Context Menus Source: https://github.com/moudey/shell/blob/main/docs/configuration/new-items.html Creates a sub-menu with properties and optional sub-items. Requires either a 'title' or 'image' property. ```plaintext menu( title = value [property = value [...] ]) { [ item() [...] ] [ menu(){} [...] ] [ separator [...] ] [ import 'path/to/import.nss' [...] ] } ``` -------------------------------- ### Get Name Without Extension Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the name of the selected item, excluding its file extension. ```shell sel.path.title ``` -------------------------------- ### Display Help Message Source: https://github.com/moudey/shell/blob/main/docs/installation.html Displays the help message for Nilesoft Shell command-line options. ```shell shell -? ``` -------------------------------- ### command.copy and command.copy_to_clipboard Source: https://github.com/moudey/shell/blob/main/docs/functions/command.html Copies the provided string to the system clipboard. ```APIDOC ## command.copy, command.copy_to_clipboard ### Description Copies the provided string to the system clipboard. ### Syntax `command.copy('string copy to clipboard')` ``` -------------------------------- ### Get Current Directory Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Retrieves the current working directory for the active process. No arguments are needed. ```javascript path.currentdirectory ``` -------------------------------- ### Find Property: File Extension Matching Source: https://github.com/moudey/shell/blob/main/docs/configuration/properties.html Matches files with the exact '.exe' extension. ```plaintext find = '.exe' ``` -------------------------------- ### Find Property: Multiple File Extension Matching Source: https://github.com/moudey/shell/blob/main/docs/configuration/properties.html Matches files with either the '.exe' or '.dll' extension. ```plaintext find = '.exe|.dll' ``` -------------------------------- ### Breaking Long Lines in Item Configuration Source: https://github.com/moudey/shell/blob/main/docs/configuration/index.html Demonstrates how to break long lines in item configurations for better readability, using line breaks within parentheses and single quotes for string values. ```shell item(title='Command prompt' cmd='cmd.exe') ``` -------------------------------- ### Get Raw Path by Index Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Retrieves the raw path of a selected item using its zero-based index. ```shell sel.path.raw(index=`0`) ``` -------------------------------- ### Get Parent Directory Name Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Returns the name of the parent directory from a given path. This is equivalent to path.location.name. ```javascript path.location.name(path) ``` -------------------------------- ### path.file.ext Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Return the extension of path. ```APIDOC ## path.file.ext ### Description Return the extension of path ### Syntax `path.file.ext(path)` ``` -------------------------------- ### Copy File with Options Source: https://github.com/moudey/shell/blob/main/docs/functions/io.html Copies a file from a source path to a destination path. Supports options for skipping, overwriting, updating, and recursive copying. ```javascript io.copy('c:\old', 'd:\new', 16 | 4) ``` -------------------------------- ### Get Parent Directory Path Source: https://github.com/moudey/shell/blob/main/docs/functions/path.html Returns the path of the parent directory for a given path. This is equivalent to path.parent. ```javascript path.location(path) ``` -------------------------------- ### Theme Customization (`theme` Block) Source: https://context7.com/moudey/shell/llms.txt Allows for full customization of the visual appearance of the Shell context menu, including colors, fonts, and layout. ```APIDOC ## `theme` Block Fully customize the visual appearance of the Shell context menu. ```nss theme { name = "modern" // auto | classic | white | black | modern view = view.compact // auto | compact | small | medium | large | wide dark = default // true | false | default (follows system) background { color = #1e1e2e opacity = 95 effect = 3 // 0=none, 1=transparent, 2=blur, 3=acrylic // Acrylic with tint: // effect = [3, #1e1e2e, 80] gradient { enabled = true linear = [0, 100, 0, 0] // [x1, x2, y1, y2] stop = [[0.0, #1e1e2e], [1.0, #313244]] } } item { radius = 2 text { normal = #cdd6f4 select = #1e1e2e } back { normal = #00000000 select = #89b4fa } border{ select = #89b4fa } padding { left=12 right=12 top=4 bottom=4 } } border { enabled = true size = 1 color = #45475a radius = 8 } shadow { enabled = true size = 20 color = #000000 opacity = 60 offset = 4 } font { name = "Segoe UI Variable" size = 10 weight = 4 } separator { size = 1 color = #45475a margin = [12, 4] } layout { rtl = false popup = 0 } } ``` ``` -------------------------------- ### Get Selected Item Count Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the total number of currently selected file system items. ```shell sel.count ``` -------------------------------- ### Get Parent Path Length Source: https://github.com/moudey/shell/blob/main/docs/functions/sel.html Returns the number of characters in the parent directory path of the selected item. ```shell sel.parent.length ```