none
How to get CMD window with 'timer' e.g. "waiting for xxx seconds" an option to apply change immediately? RRS feed

  • Question

  • I have a VBS code that hides/unhides a folder using password.

    When folder is unhidden, another CMD pops up minimized and waits for, let's say, 10 minutes and then hides folder automatically.

    I did it so I don't forget to lock the folder after I'm done.

    Problem is that sometimes I did what was needed in less than 10 minutes and CMD window, even, minimized, kinda gets on my nerves. The only option is to press CTRL+C to cancel it. But this leaves folder unlocked.

    I want CMD to count 10 minutes but also give option to type Y to lock the folder right away. Like two lines, one with timer and other with text like "Lock folder right away?<Y/N>" (No option is not necessary)

    The code is:

    :TIMEOUT 
    set minimized=true
    start /min cmd.exe /c "timeout /t 600 /nobreak & attrib +h +s "Private Folder" & goto End"

    I tried to add code E.g.

    "set/p "cho=>" 
    if %cho%==Y goto LOCK 
    if %cho%==y goto LOCK"

    on the end of the line & ... & ..., etc.

    But it does not work.

    How do I do this?

    Another minor question, is "set minimized=true" necessary? It works without it, I believe.

    Thank you in advance.

    Thursday, November 3, 2016 9:36 PM

Answers

  • I already solved the problem myself.

    Even easier solution. My code contained / nobreak

    I removed it and now I can just type any letter in order to hide folder right away.

    • Marked as answer by Invictus91 Friday, November 4, 2016 1:22 PM
    Friday, November 4, 2016 1:22 PM

All replies

  • It can also be done through PowerShell, if you help me how.
    Thursday, November 3, 2016 9:39 PM
  • What can also be done through PowerShell?

    How are you hiding a folder?

    Just use permissions.


    -- Bill Stewart [Bill_Stewart]

    Thursday, November 3, 2016 9:55 PM
    Moderator
  • You will not be able to do this with batch.  PowerShell can do this but you will have to learn PowerShell first.

    Sorry.


    \_(ツ)_/

    Friday, November 4, 2016 1:21 PM
  • I already solved the problem myself.

    Even easier solution. My code contained / nobreak

    I removed it and now I can just type any letter in order to hide folder right away.

    • Marked as answer by Invictus91 Friday, November 4, 2016 1:22 PM
    Friday, November 4, 2016 1:22 PM
  • What can also be done through PowerShell?

    How are you hiding a folder?

    Just use permissions.


    -- Bill Stewart [Bill_Stewart]

    He is not using permission.  It is done with "attrib +h"

    I would ask why the OP thinks this needs to be done.  It seems a bit foolish.


    \_(ツ)_/


    • Edited by jrv Friday, November 4, 2016 1:22 PM
    Friday, November 4, 2016 1:22 PM
  • It seems we have another case of a poorly asked question.

    \_(ツ)_/

    Friday, November 4, 2016 1:24 PM
  • Setting the "hidden" attribute on a directory doesn't provide any security - it just prevents the directory from appearing in Explorer's default view and default file listings in cmd/PowerShell. If you specify to show hidden items, you can see them just fine. Not sure what the OP thinks he is accomplishing.

    -- Bill Stewart [Bill_Stewart]

    Friday, November 4, 2016 3:30 PM
    Moderator