shortcuts to batch file

November 11, 2010 at 10:24:28
Specs: Windows XP/Vista/7
With certain programs you can modify the target of a shortcut to include some parameters i.e. -w to make the program into a window or -f for full screen.

Can you have this with a shortcut linking to a batch file?

The original batch file opens with a prompt asking for 1 of 3 inputs (L/S/N).
Can you adjust the shortcut so that this user input is automatically inserted?


See More: shortcuts to batch file

Report •

#1
November 12, 2010 at 22:42:48
Try this (preliminary testing in XP only):

R.Click on the shortcut & select Properties.

In the Target dialog box enter %comspec% /k echo input|batfile.bat where input is L S or N and batfile.bat is the name of your batch script.

Might work - no warranties given or implied.

Did you Google for an answer before asking the question?


Report •

#2
November 22, 2010 at 10:53:18
Thanks a lot. Worked a treat in XP, vista and 7.

Report •

#3
November 22, 2010 at 11:20:14
You're welcome - thanks for coming back to report your success.

W.

Did you Google for an answer before asking the question?


Report •

Related Solutions

#4
April 8, 2011 at 09:26:43
What about if I just want to prompt the user for input in a shortcut which calls a bat?

Report •

#5
April 9, 2011 at 03:41:03
Yes, that's feasible but the entered input must be stored in an Environment Variable so that it's available to the batch script which has not yet been executed.

e.g. If the Target dialog box contains
%comspec% /k set /p name=Enter your name &script.bat
Cmd.exe will open then execute the Set /p command and await user input then open script.bat

I have used this type of Target many times but find that prompting for user input is easier from within the batch script.

Good luck

Did you Google for an answer before asking the question?


Report •

Ask Question