Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 8 down vote accepted

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.

EDIT

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
setlocal
set /P passwd=Password:
call runprog.bat %passwd%
endlocal
share|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
share|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!"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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