How to run a file from the Windows Run prompt without including the file extension












0















If I have a PowerShell script named myscript.ps1 and it sits in the PATH, I'd like to be able to press Windows + r, type "myscript", and press enter. Currently it requires me to type myscript.ps1, and it runs fine.



I've found a few answers that suggested ftype, assoc, and the PATHEXT environment variable, but that only affects scripts run from command prompt or PowerShell, not from explore.exe's Run prompt.



I assume there's some registry setting, but I don't know what to search for, as fileext has hundreds of entries. I also searched for .bat since batch files work automatically, but I haven't found anything obvious.



I thought I'd found it under under HKLMSOFTWAREMicrosoftWindowsCurrentVersionExplorerKindMap by adding a .ps1 value and setting it to program as .bat, .cmd, .com, and .exe all are set that way, but no dice (even after restarting my computer).



I also noticed that .bat, .cmd, .exe, .lnk, and .msi each had an HKCR<app-handler-id>shellexPropertySheetHandlersShimLayer Property Page set to {513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}, but adding that to HKCRMicrosoft.Powershell.1 didn't worth either.










share|improve this question

























  • You could write a wrapper script, that would list all your personal scripts and let you pick one to run?

    – Xen2050
    Jan 18 at 0:18











  • I considered that, and I might do it, but I still want my question answered. I'm curious how Windows works.

    – dx_over_dt
    Jan 18 at 0:19











  • I guess you need the full name to run things. If you were in a terminal, you could try pressing TAB to auto-complete many things (programs, files, directories...)

    – Xen2050
    Jan 18 at 1:06













  • Certain file extensions aren't required though: .bat, .exe, .cmd, etc. I assume those aren't hard-coded into the OS, so there should be a way to change them and add .ps1.

    – dx_over_dt
    Jan 18 at 1:08






  • 1





    @EricW. Yeah, I just don't like workarounds in general. Plus, it requires a batch file for every script unless you want to use the ps1 script as an argument to the batch script; in that case it ends up saving you a total of 2 characters assuming the batch's file name is only 1. It turns out .lnk (shortcut files) also do not require an extension, so I think I'm going to go that route for my one script.

    – dx_over_dt
    Jan 18 at 21:11
















0















If I have a PowerShell script named myscript.ps1 and it sits in the PATH, I'd like to be able to press Windows + r, type "myscript", and press enter. Currently it requires me to type myscript.ps1, and it runs fine.



I've found a few answers that suggested ftype, assoc, and the PATHEXT environment variable, but that only affects scripts run from command prompt or PowerShell, not from explore.exe's Run prompt.



I assume there's some registry setting, but I don't know what to search for, as fileext has hundreds of entries. I also searched for .bat since batch files work automatically, but I haven't found anything obvious.



I thought I'd found it under under HKLMSOFTWAREMicrosoftWindowsCurrentVersionExplorerKindMap by adding a .ps1 value and setting it to program as .bat, .cmd, .com, and .exe all are set that way, but no dice (even after restarting my computer).



I also noticed that .bat, .cmd, .exe, .lnk, and .msi each had an HKCR<app-handler-id>shellexPropertySheetHandlersShimLayer Property Page set to {513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}, but adding that to HKCRMicrosoft.Powershell.1 didn't worth either.










share|improve this question

























  • You could write a wrapper script, that would list all your personal scripts and let you pick one to run?

    – Xen2050
    Jan 18 at 0:18











  • I considered that, and I might do it, but I still want my question answered. I'm curious how Windows works.

    – dx_over_dt
    Jan 18 at 0:19











  • I guess you need the full name to run things. If you were in a terminal, you could try pressing TAB to auto-complete many things (programs, files, directories...)

    – Xen2050
    Jan 18 at 1:06













  • Certain file extensions aren't required though: .bat, .exe, .cmd, etc. I assume those aren't hard-coded into the OS, so there should be a way to change them and add .ps1.

    – dx_over_dt
    Jan 18 at 1:08






  • 1





    @EricW. Yeah, I just don't like workarounds in general. Plus, it requires a batch file for every script unless you want to use the ps1 script as an argument to the batch script; in that case it ends up saving you a total of 2 characters assuming the batch's file name is only 1. It turns out .lnk (shortcut files) also do not require an extension, so I think I'm going to go that route for my one script.

    – dx_over_dt
    Jan 18 at 21:11














0












0








0


1






If I have a PowerShell script named myscript.ps1 and it sits in the PATH, I'd like to be able to press Windows + r, type "myscript", and press enter. Currently it requires me to type myscript.ps1, and it runs fine.



I've found a few answers that suggested ftype, assoc, and the PATHEXT environment variable, but that only affects scripts run from command prompt or PowerShell, not from explore.exe's Run prompt.



I assume there's some registry setting, but I don't know what to search for, as fileext has hundreds of entries. I also searched for .bat since batch files work automatically, but I haven't found anything obvious.



I thought I'd found it under under HKLMSOFTWAREMicrosoftWindowsCurrentVersionExplorerKindMap by adding a .ps1 value and setting it to program as .bat, .cmd, .com, and .exe all are set that way, but no dice (even after restarting my computer).



I also noticed that .bat, .cmd, .exe, .lnk, and .msi each had an HKCR<app-handler-id>shellexPropertySheetHandlersShimLayer Property Page set to {513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}, but adding that to HKCRMicrosoft.Powershell.1 didn't worth either.










share|improve this question
















If I have a PowerShell script named myscript.ps1 and it sits in the PATH, I'd like to be able to press Windows + r, type "myscript", and press enter. Currently it requires me to type myscript.ps1, and it runs fine.



I've found a few answers that suggested ftype, assoc, and the PATHEXT environment variable, but that only affects scripts run from command prompt or PowerShell, not from explore.exe's Run prompt.



I assume there's some registry setting, but I don't know what to search for, as fileext has hundreds of entries. I also searched for .bat since batch files work automatically, but I haven't found anything obvious.



I thought I'd found it under under HKLMSOFTWAREMicrosoftWindowsCurrentVersionExplorerKindMap by adding a .ps1 value and setting it to program as .bat, .cmd, .com, and .exe all are set that way, but no dice (even after restarting my computer).



I also noticed that .bat, .cmd, .exe, .lnk, and .msi each had an HKCR<app-handler-id>shellexPropertySheetHandlersShimLayer Property Page set to {513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8}, but adding that to HKCRMicrosoft.Powershell.1 didn't worth either.







windows






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 21:08







dx_over_dt

















asked Jan 18 at 0:05









dx_over_dtdx_over_dt

14610




14610













  • You could write a wrapper script, that would list all your personal scripts and let you pick one to run?

    – Xen2050
    Jan 18 at 0:18











  • I considered that, and I might do it, but I still want my question answered. I'm curious how Windows works.

    – dx_over_dt
    Jan 18 at 0:19











  • I guess you need the full name to run things. If you were in a terminal, you could try pressing TAB to auto-complete many things (programs, files, directories...)

    – Xen2050
    Jan 18 at 1:06













  • Certain file extensions aren't required though: .bat, .exe, .cmd, etc. I assume those aren't hard-coded into the OS, so there should be a way to change them and add .ps1.

    – dx_over_dt
    Jan 18 at 1:08






  • 1





    @EricW. Yeah, I just don't like workarounds in general. Plus, it requires a batch file for every script unless you want to use the ps1 script as an argument to the batch script; in that case it ends up saving you a total of 2 characters assuming the batch's file name is only 1. It turns out .lnk (shortcut files) also do not require an extension, so I think I'm going to go that route for my one script.

    – dx_over_dt
    Jan 18 at 21:11



















  • You could write a wrapper script, that would list all your personal scripts and let you pick one to run?

    – Xen2050
    Jan 18 at 0:18











  • I considered that, and I might do it, but I still want my question answered. I'm curious how Windows works.

    – dx_over_dt
    Jan 18 at 0:19











  • I guess you need the full name to run things. If you were in a terminal, you could try pressing TAB to auto-complete many things (programs, files, directories...)

    – Xen2050
    Jan 18 at 1:06













  • Certain file extensions aren't required though: .bat, .exe, .cmd, etc. I assume those aren't hard-coded into the OS, so there should be a way to change them and add .ps1.

    – dx_over_dt
    Jan 18 at 1:08






  • 1





    @EricW. Yeah, I just don't like workarounds in general. Plus, it requires a batch file for every script unless you want to use the ps1 script as an argument to the batch script; in that case it ends up saving you a total of 2 characters assuming the batch's file name is only 1. It turns out .lnk (shortcut files) also do not require an extension, so I think I'm going to go that route for my one script.

    – dx_over_dt
    Jan 18 at 21:11

















You could write a wrapper script, that would list all your personal scripts and let you pick one to run?

– Xen2050
Jan 18 at 0:18





You could write a wrapper script, that would list all your personal scripts and let you pick one to run?

– Xen2050
Jan 18 at 0:18













I considered that, and I might do it, but I still want my question answered. I'm curious how Windows works.

– dx_over_dt
Jan 18 at 0:19





I considered that, and I might do it, but I still want my question answered. I'm curious how Windows works.

– dx_over_dt
Jan 18 at 0:19













I guess you need the full name to run things. If you were in a terminal, you could try pressing TAB to auto-complete many things (programs, files, directories...)

– Xen2050
Jan 18 at 1:06







I guess you need the full name to run things. If you were in a terminal, you could try pressing TAB to auto-complete many things (programs, files, directories...)

– Xen2050
Jan 18 at 1:06















Certain file extensions aren't required though: .bat, .exe, .cmd, etc. I assume those aren't hard-coded into the OS, so there should be a way to change them and add .ps1.

– dx_over_dt
Jan 18 at 1:08





Certain file extensions aren't required though: .bat, .exe, .cmd, etc. I assume those aren't hard-coded into the OS, so there should be a way to change them and add .ps1.

– dx_over_dt
Jan 18 at 1:08




1




1





@EricW. Yeah, I just don't like workarounds in general. Plus, it requires a batch file for every script unless you want to use the ps1 script as an argument to the batch script; in that case it ends up saving you a total of 2 characters assuming the batch's file name is only 1. It turns out .lnk (shortcut files) also do not require an extension, so I think I'm going to go that route for my one script.

– dx_over_dt
Jan 18 at 21:11





@EricW. Yeah, I just don't like workarounds in general. Plus, it requires a batch file for every script unless you want to use the ps1 script as an argument to the batch script; in that case it ends up saving you a total of 2 characters assuming the batch's file name is only 1. It turns out .lnk (shortcut files) also do not require an extension, so I think I'm going to go that route for my one script.

– dx_over_dt
Jan 18 at 21:11










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395584%2fhow-to-run-a-file-from-the-windows-run-prompt-without-including-the-file-extensi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1395584%2fhow-to-run-a-file-from-the-windows-run-prompt-without-including-the-file-extensi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?