Allow a "dircmd" type of environment variable for

Post your new features ideas and suggestions here.
jdan
Posts: 17
Joined: Tue Feb 20, 2007 5:13 am

Allow a "dircmd" type of environment variable for

Postby jdan » Wed Feb 21, 2007 5:52 am

Some "DOS" type commands, such as DIR and XCOPY, allow you to specify command line parameters in an environment variable (called DIRCMD and COPYCMD).

So in case you always want certain command line parameters passed each time, you don't have to keep adding them on the command line - you just define the environment variable to contain the command line options you always want, and every time you run those programs from then on, it is as if you had added those command line parameters as well.

For example, I define DIRCMD to be /ogne/a/x, since I always want those command line options for the DIR command.

Of course anything that you explicitly add to the command line will override anything specified in the environment variable.

Can you make wincmp and wndsync support this as well, so that I can predefine certain command line options in corresponding environment variables rather than have to add them to the command line each time?

grigsoft
Site Admin
Posts: 1671
Joined: Tue Sep 23, 2003 7:37 pm

Postby grigsoft » Wed Feb 21, 2007 7:54 am

Environment variable seems a bit outdated to me, but probably I will add something like this - maybe as an internal option like "Default command line". Also you can create shortcut with desired parameters - so you can call your common cmdline and still can use direct commands in some cases.

jdan
Posts: 17
Joined: Tue Feb 20, 2007 5:13 am

Postby jdan » Fri Feb 23, 2007 2:01 am

An internal option would be good.

The problem with shortcuts, is that they only work from the desktop, not from a command shell. I run wincmp and wndsync from the command shell the majority of the time right where my source files to compare are located, and I specify the files/folders to compare on the command line, so an internal option or environment variable are the only available options.

Yes, environment variables are old-style, but they are available to programs launched from the desktop as well as the command shell - you just need to define them in the system or user wide environment variables under MyComputer > Properties > Advanced > Environment variables.

grigsoft
Site Admin
Posts: 1671
Joined: Tue Sep 23, 2003 7:37 pm

Postby grigsoft » Fri Feb 23, 2007 5:30 am

Hmm, I think that if you create shortcut with different name, it will be used correctly from command line too. Am i wrong?

jdan
Posts: 17
Joined: Tue Feb 20, 2007 5:13 am

Postby jdan » Sun Feb 25, 2007 4:47 am

If I were to create a shortcut in some directory, lets say c:\work, and I called the shortcut diff, then a file called diff.lnk will show up in that directory.

Then if I have a command shell open, and set my current working directory to that directory, then I can run that shortcut by typing "diff.lnk".

But I can also run any other program or even a file such as a text file as well (the command shell will look up the file association for the text file). So the shortcut is not treated any different than any other file, but it is treated a bit differently than a program is.

But I must remember to enter the full name including the .lnk file extension, and of course it will only work while in that folder, or if I place the shortcut in the "path", then it will work from other directories as well.

So it is possible to do it this way - but it is not intuitive (meaning that I must remember to add the .lnk), and if you consider environment variables to be "outdated", then you must admit that the path is "outdated" as well, since these are DOS/command shell concepts, and not "Windows" concepts.

grigsoft
Site Admin
Posts: 1671
Joined: Tue Sep 23, 2003 7:37 pm

Postby grigsoft » Mon Feb 23, 2009 8:49 am

Suggested by Aaron:

You can omit the .lnk (or any other registered extension) by executing this:
setx pathext %pathext%;.lnk

Works only for apps/consoles started afterwards; in the current folder as well as all the path.

bobkilmer
Posts: 1
Joined: Fri Feb 29, 2008 1:44 pm

Re: Allow a "dircmd" type of environment variable for

Postby bobkilmer » Sun Mar 05, 2017 4:08 pm

I know 10 years has gone by since this was originally posted but it shouldn't bother anyone if I post this reply. I still use small but handy command line batch file utilities all the time in my work as a programmer analyst in Windows 10 +/-.

1. Create a batch file directory. C:\bat, for instance.
2. Put it in the system path.
3. Create batch files there as necessary.
4. Call the batch files at a command prompt or from the Start > Search box.

You can start apps with parameters this way. You can start a command prompt with a customized environment. You put a batch file in this directory just to call a shortcut w/o having to specify a path, etc.


Return to “Compare It! - Suggestions”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest