I swear I remember some way in Windows-past to set up a desktop shortcut that would prompt for input and pass that into the command it's running. Specifically, I want to run a batch file that takes a password as input, but not store that password in the shortcut.

Is there a way to do this in Windows 7?


In previous versions of Windows, in order to make a shortcut prompt for command-line options, all you had to do was edit the command line in the shortcut properties window, appending a ? at the very end. This flagged Windows to prompt you with a dialog box for additional command-line switches.

I don't think that this method works in Windows 7 (I just tried it). It may have been removed in lieu of another method, or just removed altogether.


I just did a quick search. Apparently it was an old 16-bit PIF method for prompting for command-line switches. It didn't make it to Windows 7 (presumably, you can't use this in Windows XP, either--it was ditched after Windows 9x went out, and they moved wholly over to the 32-bit LNK method).

In order to emulate it, you likely will have to write your own batch script (or something similar) to emulate this functionality.

For instance, this Windows batch code should do the trick for you.

@echo off
set /P passwd=Password:
call runprog.bat %passwd%
| improve this answer | |
  • 2
    That was what I was remembering :-( – dbreaux Mar 13 '12 at 21:33

Maybe this is what you remember:

> usermessage.vbs ECHO WScript.Echo InputBox( "Where were you born?", "Place of Birth", "London" )
FOR /F "tokens=*" %%A IN ('CSCRIPT.EXE //NoLogo usermessage.vbs') DO SET PlaceOfBirth=%%A
ECHO You were born in %PlaceOfBirth%
DEL usermessage.vbs
| improve this answer | |
  • Not what I remember, but looks useful. Thanks. – dbreaux Mar 13 '12 at 21:40

Here is an example of what I did. Create a shortcut and change the target to read:

cmd /v:on /c "set /P param=Computer name: && %windir%\system32\compmgmt.msc /computer:!param!"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.