[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"howto:kts:windows:en":3},{"resolvedFromAlias":4,"canonicalExt":5,"ext":5,"name":6,"category":7,"categoryName":8,"updatedAt":9,"os":10,"osLabel":11,"quickSolution":12,"stepByStep":13,"recommendedSoftware":16,"alternativeMethods":17,"commonIssues":18,"securityNote":38,"extensionPath":39,"extensionLabel":40,"breadcrumbs":41,"metaDescription":51},false,"kts","Kotlin Script","code","Code","2026-06-12T09:04:56.042Z","windows","Windows","To open .KTS files on Windows, to view/edit: open the .kts file in a code editor (any plain-text editor works for reading).",[14,15],"To view/edit: open the .kts file in a code editor (any plain-text editor works for reading).","To run as a Kotlin script: install the Kotlin command-line compiler and run: kotlinc -script path\\to\\file.kts",[],[],[19,25,31],{"title":20,"description":21,"steps":22},"Double-clicking doesn’t run the script",".kts files are source code; most operating systems do not execute them by default when you double-click.",[23,24],"Open the file in a code editor to inspect it as text.","Run it from a terminal with the Kotlin compiler: kotlinc -script file.kts",{"title":26,"description":27,"steps":28},"Trying to run a Gradle Kotlin DSL file as a standalone script","Files like build.gradle.kts are Gradle build scripts written in Kotlin DSL; they are meant to be evaluated by Gradle, not executed as a generic Kotlin script.",[29,30],"If the file is named build.gradle.kts (or settings.gradle.kts), treat it as a Gradle build configuration.","Run it through Gradle as part of the project (not via kotlinc -script).",{"title":32,"description":33,"steps":34},"Script fails because Kotlin tooling isn’t installed or on PATH","Running a .kts file requires the Kotlin command-line compiler (kotlinc). If it is missing or not available in your shell PATH, the command won’t work.",[35,36,37],"Install the Kotlin command-line tools.","Verify kotlinc is available by running: kotlinc -version","Re-run the script using: kotlinc -script file.kts",".kts files are executable code when run (for example with kotlinc -script). Only run scripts from sources you trust, because they can perform actions allowed by your user account.","/file-extension/kts",".KTS",[42,45,48],{"label":43,"to":44},"Home","/",{"label":46,"to":47},"How To","/file-extension",{"label":49,"to":50},"Open .KTS on Windows","/how-to/open-kts-on-windows","Learn how to open .KTS files on Windows with step-by-step instructions, recommended software, and troubleshooting tips."]