Windows 98 shortcuts versus Windows 2000 shortcuts

Posted by: tfabris

Windows 98 shortcuts versus Windows 2000 shortcuts - 11/12/2003 14:41

I have a batch file which processes the command line parameter as "%1", allowing me to pass information into the batch file via the command line. Standard stuff.

When I create a shortcut to the batch file in Windows 98 (and all prior versions of Windows if I recall correctly), I can edit the properties of the shortcut and place a question mark on the command line to the batch file.

The question mark is interpreted by Windows, preprocessed before execution. When I doubleclick on the shortcut, Windows stops and puts up an interactive dialog box where I can enter the parameter I want in place of a question mark. Then it runs the program with that parameter.

Thus, allowing me to change the parameter to the batch file interactively from a Windows interface. Neat.

Another thing I can do with the properties of that shortcut is choose to check or to uncheck the option that reads "Close on exit". This allows me to choose whether or not the batch file's window will disappear when it's done running.

Okay, so far so good. The above is just background... Anyone who's messed with batch files enough in Windows knows about that stuff.

But here's where it gets interesting:

In Windows 2000, if I create a shortcut to that batch file, it does not honor the question mark as an interactive prompt, it merely passes a question mark to the batch file as the parameter. AND... It doesn't offer me the "Close on Exit" option, either.

So Windows 2000 has simply removed those features, right? Not quite. It gets even more interesting here:

If I copy the shortcut file created in Windows 98 onto Windows 2000, then run that shortcut file, it works, and when I edit the properties of the shortcut I see all of the options that I had originally seen in Windows 98.

Although it's a bit buggy. My command line gets truncated if it's too long (I had to edit "Program Files" to "Progra~1" to get it to fit), and one of the fields in the properties box was garbage characters (those square symbols you see when high ascii is displayed in a Windows dialog box).

Anyone know what's going on here, and if there is a way I can create this "old style" shortcut natively in Windows 2000?
Posted by: g_attrill

Re: Windows 98 shortcuts versus Windows 2000 short - 11/12/2003 18:18

I briefly tried to do this a couple of weeks ago and was also stumped. I have just done a google search and come up with this:

http://groups.google.com/groups?th=4cf103593287e674

Not a fix but a workaround.

Gareth
Posted by: tfabris

Re: Windows 98 shortcuts versus Windows 2000 short - 11/12/2003 18:39

The link from that discussion thread that supposedly points to the work around failed when I clicked on it. Oh well.
Posted by: ricin

Re: Windows 98 shortcuts versus Windows 2000 short - 11/12/2003 19:38

http://web.archive.org/web/20001205081900/http://www.jsiinc.com/TIP0300/rh0323.htm


SET /P variable=[prompt]

works too.
Posted by: wfaulk

Re: Windows 98 shortcuts versus Windows 2000 short - 12/12/2003 10:01

Is it possible that it's a difference between cmd.exe and command.com? The Win98 shortcut would be referencing the latter, while the Win2k one would not.
Posted by: tfabris

Re: Windows 98 shortcuts versus Windows 2000 short - 12/12/2003 12:39

Hm, that's possible, but it still doesn't explain the totally different properties boxes for the two different shortcuts.
Posted by: larry818

Re: Windows 98 shortcuts versus Windows 2000 short - 13/12/2003 04:51

As you probably know, under win2K, if you ceate a shortcut to an executable (.exe) file, you get more control propertites than if you create a shorcut to a .bat file. One way I've worked around this is to create my shortcut to some random .exe file, then modify the propertites to point to my .bat file. You'll retain all the control associated with the .exe profile.

Hope this helps in your case.
Posted by: tfabris

Re: Windows 98 shortcuts versus Windows 2000 short - 13/12/2003 12:16

This technique, when I tried it just now, did not produce a set of options that were any different than I would get by creating the shortcut directly to the batch file. Perhaps I was doing it wrong.
Posted by: lectric

Re: Windows 98 shortcuts versus Windows 2000 short - 14/12/2003 11:03

Have you tried creating a .pif instead? ISTR this works, but I don't have a win2k box handy at the moment to test with.
Posted by: tfabris

Re: Windows 98 shortcuts versus Windows 2000 short - 14/12/2003 11:39

Have you tried creating a .pif instead?
I thought that when you created a shortcut to a batch file, that WAS a .pif. I thought you only get .lnk files when you create shortcuts to Windows EXEs or registered document types.

How would you go about creating a .pif specifically? I don't know where or how to specify which thing I'm creating. The only way I ever knew how was: Shortcuts to windows programs and documents were LNKs, shortcuts to batch files and DOS programs were PIFs.
Posted by: Mataglap

Re: Windows 98 shortcuts versus Windows 2000 short - 14/12/2003 19:34

In reply to:

Is it possible that it's a difference between cmd.exe and command.com?




Yes, command is more or less the 16 bit DOS command interpreter, where as cmd.exe is the 32bit version for WinNT based systems. Most of the time the differences don't matter, but sometimes they do.

--Nathan
Posted by: larry818

Re: Windows 98 shortcuts versus Windows 2000 short - 16/12/2003 10:07

I tried it just before posting to be sure I wasn't high, and tried it again just now. I have two shortcuts, both pointing to the same .bat file. The one created to the .bat shows tabs for genera/shortcut/options/font/layout/colours/security. The one created to an .exe and then edited to the .bat shows tabs for memory/screen/misc/general/summary/security/program/font. Usually it's the memory and screen stuff I want to control.
Posted by: tfabris

Re: Windows 98 shortcuts versus Windows 2000 short - 16/12/2003 10:18

Do either of those options show the feature "Close On Exit", or do either of them allow you to place a question mark on the command line and get a Windows prompt for the parameters?
Posted by: larry818

Re: Windows 98 shortcuts versus Windows 2000 short - 17/12/2003 10:35

Yes it does, I've just tested it. However, I found out that the shortcut with expanded capabilities has to first be made to a dos app, if you make it to a winders .exe file, you won't get these options.
Posted by: wfaulk

Re: Windows 98 shortcuts versus Windows 2000 short - 17/12/2003 10:36

Thus, cmd vs. command.
Posted by: tfabris

Re: Windows 98 shortcuts versus Windows 2000 short - 17/12/2003 11:47

Thus, cmd vs. command.
But "Command" doesn't exist on a fully Windows-NT system. It only exists on a dual-boot system with Dos and NT.

At least, I thought that was the case...?
Posted by: peter

Re: Windows 98 shortcuts versus Windows 2000 short - 17/12/2003 11:56

But "Command" doesn't exist on a fully Windows-NT system. It only exists on a dual-boot system with Dos and NT.
c:\winnt\system32\command.com

Peter
Posted by: tfabris

Re: Windows 98 shortcuts versus Windows 2000 short - 17/12/2003 11:59

Interesting!

So that's the secret, then? Make sure that the shortcut is for command instead of CMD?

So instead of pointing directly to the batch file, I point the shortcut to "command.com batchfile ?" ?
Posted by: tfabris

Re: Windows 98 shortcuts versus Windows 2000 short - 17/12/2003 12:05

Hmm. Not quite. The shortcut properties work, but it doesn't run the batch file and instead displays an error message. There's a field for "Batch File" but it doesn't seem to do anything.

Interesting thing is, when I edited the shortcut properties to add "command.com", saved the changes, exited the properties panel, and went back in, it said "this is not a valid shortcut". But then ten seconds later, it worked and had the new properties page.