Command-Line toolkit

Discussion in 'Software' started by Imandy Mann, Jan 10, 2015.

  1. Imandy Mann

    Imandy Mann MajorGeekolicious

    While readind a link in a post for athread here I ran across this article. Good for those who like using command line programs and utilities. Also explains use of some and links to good other code. One I found interesting was UnixUtils. It's a windows port of alot of unix type commands. I keep a toolkit folder already with normal 'windows' programs and now will make another. Article shows how to place it in the 'path' so you just need the command name not the fully qualified path to use the commands directly.

    http://www.bleepingcomputer.com/tutorials/command-line-toolkit-for-windows/
     
  2. DavidGP

    DavidGP MajorGeeks Forum Administrator - Grand Pooh-Bah Staff Member

    Hi Imandy

    Yeah the CMD line can be really useful in may circumstances, not used as much these days but I still rely on a few commands a lot for troubleshooting especially network issues and tracert is great for that.

    The guide is good but missed a fair bit out, while I think they are concentrating on the general commands the full list and explanations are HERE @ TechNet (TechNet/MSDN is a great resource that should be read at times, while its aimed at technical folk, its still apt for many issues ot advice you may need)
     
  3. Imandy Mann

    Imandy Mann MajorGeekolicious

    Yes your link provides a good list and background for MS utilities. I also took from the article the convience of using even non-MS utilities in the same way and stored in the same easily accessible folder and path for quick go-to use. And it does start to seem like an old ms-dos dir command with all keywords listed plus others that may be added as each different user wishes. I know a lot of this can be found by starting to type the commands name in the search box but to have it in the path seems like a way to be more flexible. Maybe even add a batch or powershell command so I type "MG"<enter> and goto MG's. Right now I go to an 'Internet_n_Mail folder and then click on my shortcut to the site. Could eliminate that extra click. And might be neat to do it from a command window if already there.
     
  4. GermanOne

    GermanOne Guest

    You can use a Batch file just like any other command line tool. Acting on your example you could create a folder where you would save all of your own tools. Add that folder to the PATH environment to enable running the tools without specifying the entire path.

    Save the following code with extension .bat then right-click the file and "Run As Administrator". It will automate what I wrote above.
    Code:
    @echo off &setlocal
    
    :: Create "myTools" folder and permanently add it to the Path environment
    if not exist "C:\myTools\" (
      md "C:\myTools"
      setlocal EnableDelayedExpansion
      setx /m Path "!Path!;C:\myTools"
      endlocal
    )
    
    :: Create "MG.bat" that opens MajorGeeks.com in your default browser
    >"C:\myTools\MG.bat" echo @start http://www.majorgeeks.com/ ^&exit /b
    
    (Note that SETX could be absent on older Windows versions. You have to add ;C:\myTools manually in that case. See https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx?mfr=true)

    Now if you type MG into the search box or a cmd window MajorGeeks.com will open.

    Regards
    GermanOne
     
  5. Imandy Mann

    Imandy Mann MajorGeekolicious

    G1- Thanks. That's neat. I had already been trying at it. Made "TestTools" folder. Added the path. And had been trying the MG thing. I was going about it wrong though by trying to use a shortcut instead of as in your last line 'start'. I'll check out the resource link too.
     
  6. Imandy Mann

    Imandy Mann MajorGeekolicious

    G1- Couldn't get it to run. Searched for 'pass varibles to IE via command-line' and found a few hits. Microsoft - SuperUser - Stackoverflow. Couldn't get it to connect with Progra~\Intern~\iexplore. One topic was showing to use double quotes for the default browser. "" Tried it witha couple email addy's and it works pretty good.

    1 line in a batch file called 'MG'


    start "" "http://majorgeeks.com"

    Substituded 'inbox' for another file named 'ib'. Goes to one of my e-mails.
    Gonna do a few more.

    Your example got me on the right track. Thanks again.
     
  7. GermanOne

    GermanOne Guest

    Iexplore.exe is a registered program where you don't need to specify the whole path using START.

    The command line in MG.bat would look like
    Code:
    @start "" /max "iexplore" http://majorgeeks.com/ &exit /b
    The first empty pair of quotes will be interpreted as window title but doesn't affect anything for programs that don't open in the (DOS-like) console window.

    In case you want to write the Batch file via ECHO redirection from within another Batch code (as I did above) you have to mask the ampersand with a caret prepended.
    Code:
    >"C:\myTools\MG.bat" echo @start "" /max "iexplore" http://majorgeeks.com/ ^&exit /b
    BTW: Unfortunately there is no switch to force IE to open the URL in a new tab instead of a new window :( Other browsers do support that possibility.
     
    Last edited by a moderator: Jan 11, 2015
  8. Imandy Mann

    Imandy Mann MajorGeekolicious

    The thing I see in your example i was misssing qoutes around iexplore. However it works as shown in my last post. And just now I typed 'ib' in the search box and it did open the page in a new tab. So this is working. I have slimbrowser installed also. Next step I'll make is to swap default browser and see if everything works as is.

    Coding Genius Extraordinaire ! This must be a piece of cake for you. I'm just getting my feet wet again. But I like it. Thanks.
     
  9. GermanOne

    GermanOne Guest

    You were lucky then. It's not guaranteed and doesn't work for me (IE11 on Win7).

    I don't think you will get into trouble ;)

    I'm proud of it :) Unfortunately I'm more or less out of work since the programming sub forum was closed. nvm ...
     
    Last edited by a moderator: Jan 11, 2015
  10. Imandy Mann

    Imandy Mann MajorGeekolicious

    Maybe not totally out of work. I asked in the beginning after I signed up and a request was made for input on changes/ additions. I asked about possibly a section for code snippets or such and was directed to the 'software' forum. Didn't know there used to be a section. I've recently seen articles on what has been dropped and what has been added in new versions of Windows and it seems as things do change but commands are not going away. And as David_GP pointed out alot of admin and network stuff still needs and has this access. You gave fair good pointers to the questions I had quickly so I've no doubt you can contribute to help the community. Pleased to meet you.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds