.bat/.cmd/cmd.exe tips to speed up using windows.

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by Oziphantom »

Personally I find Windows Explorer is the best thing about Windows and as soon as I get onto another OS I find it a slog fest to get anything done...

I trust you know about Right Click > New > New Text file. As in that will make a text file in the directory you are in and auto enter rename for it.

Also Win + R is handy, but these days Win + what ever you wanted before usually works just as good. Win + R - enter path will open WE at said path.

The New pin "quick access" has becomes my fav thing ever, I have all the folders I mainly use there, C64, GitHub etc.

I trust you also know that you can put anything you like into "Send To", I have transhexlation, allowing me to right click, send to and have it opened in a hex editor. But you should be able to add a link to the dropbox directory.

If you want something more complex than Batch, the WSHost is built in and lets you make VBA or JS based scripts that can be run.

I use Corsair K series keyboard as they have re-definable macro keys and I can switch "profiles" to change their function for my current need.

Also in WE F4 will take you to the address bar allowing you to type in a new address.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by FrankenGraphics »

My gripe with win explorer is that it sometimes takes its sweet time (on my system). One or two greedy programs running (adobe) and you'll be forced to wait on occasions; sometimes for things like alt-tabbing to a particular explorer window or creating a new text file. cmd.exe on the other hand is almost always instantaneous, because it needs less. Otherwise the shell lets me do pretty much anything i want in daily use.

One thing easily overlooked is that cmd has completion, it's just that it's not autosuggesting.
Ctrl+D = folDer completion
Ctrl+F = File completion.

Not nearly as good as autocompletion, but it's there.

something more complex than Batch
It's also possible to run powershell commands from a bat or from cmd.exe directly. The former is probably great, but the latter is of limited use. you'd type "powershell" in front of every powershell command.

Admittedly, batch processing is loose and doesn't let you do things exactly the way you want.
For example, if you terminate a batch script (ctrl+c, enter), all your pushd:s are for nothing, i discovered. Your current directory won't be pulled back. That blows. There's sure to be workarounds, but so much of batch processing is workarounds.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by Oziphantom »

Ctrl+D and F? I just tried them and Ctrl+F brings up Find and Ctrl+D makes ^D. TAB works however as you would expect it to in both CMD.exe and WE address bar.

Batch files tend to be self contained, and all the modifications they make are for the purpose of the batch file, i.e they leave the user state unmodified. I think there is an option to make their actions global, buts it been a while..
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by FrankenGraphics »

oops, I forgot to write you need to cmd /f in order to activate these ctrl shortcuts. Probably the reason why they're so obscure. I've got this defaulted on my pinned cmd shortcut.

Note that tab will make a tab in the command line, so your only means afaik are ctrl-d and ctrl-f. Tapping multiple ctrl-d:s and f:s will step through any matching files, starting with the first match.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by Oziphantom »

just so we are sure we are talking about the same thing..

cmd.exe

it shows

Code: Select all

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Chrono>
So now at the command prompt I type Em[tab] and then it will autofill it to Emulation thus it shows

Code: Select all

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Chrono>Emulation
I mean it won't in Win95 or Win98
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by tepples »

But then Windows 98 is from the era when Command.com didn't mean adhesive hanging strips endorsed by MC Hammer.
User avatar
Dwedit
Posts: 4921
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by Dwedit »

Would adding DosKey.exe to your autoexec.bat complete commands in Win98? I know it gave you Up arrow and command editing.
I also know that 4DOS had tab completion.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
TmEE
Posts: 960
Joined: Wed Feb 13, 2008 9:10 am
Location: Norway (50 and 60Hz compatible :P)
Contact:

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by TmEE »

There is CMD.EXE floating around that works in 9x.

http://www.tmeeco.eu/9X4EVER/GOODIES/CMD.EXE
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by FrankenGraphics »

oziphantom wrote:[...] taling about the same thing
Hm, i tested, and it seems the /f switch is the 'culprit' here. While it enables ctrl-f and ctrl-d, it is also enabling tabs/disabling completion through the tab key.

So which you'd prefer comes down to if you prefer the pretty standard one-key press of tab, or the separation of completing files on one key, and directories on the other. Or if you need/find it useful to make tabs, i suppose.

Btw In win10, apparently, they finally introduced the usual clibboard shortcuts. I assume copying with ctrl-c would be suspended when running a bat.
Batch files tend to be self contained, and all the modifications they make are for the purpose of the batch file, i.e they leave the user state unmodified.
I googled running directory pushing/pulling/changing code in a bat vs. batch termination by user, and it seems the common solution to this problem is letting that row or block of code run via a child instance like so: cmd /c (/c will close the child after execution is complete). This way, the %cd% of the parent will be intact even if the bat is prematurely cancelled. Even more interestingly, this technique lets the bat execute lines post-termination. (EDIT: while at it, it's probably best to make it cmd /c /d as to disregard autorun preferences local to the system)
Last edited by FrankenGraphics on Fri Aug 25, 2017 8:47 am, edited 1 time in total.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: .bat/.cmd/cmd.exe tips to speed up using windows.

Post by Oziphantom »

Ctrl + C = normal Control C
Ctrl + C when you have used the Mark option to select text = copy
Ctrl + V = paste at all times
Post Reply