Results 1 to 9 of 9
  1. #1
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,579
    Thanks
    89
    Thanked 13 Times in 12 Posts

    Completely hiding a command/batch file

    I map my OneDrive to "O" and then auto logon in my startup.

    The command I use is (password covered)

    rem net use o: https://d.docs.live.net/0D0CE3E008CF73CA /Persistent:yes /user:cwbillow@componentics.com ***********
    rem pause
    rem or with no persistence
    net use o: https://d.docs.live.net/0D0CE3E008CF73CA /user:cwbillow@componentics.com *********

    It works fine, but it flashes on the screen as it runs. Isn't there a way to run that file totally hidden?

    Chuck Billow
    Chuck Billow
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

  2. #2
    3 Star Lounger
    Join Date
    Dec 2009
    Location
    Northern California
    Posts
    379
    Thanks
    17
    Thanked 190 Times in 123 Posts
    This doesn't "completely hide" it, but should keep it from flashing briefly on your screen:

    Make a shortcut to your batch file or command script. Right-click the shortcut and select "Properties". Under the [Shortcut] tab, change "Run:" option to "Minimized". Save the change.

    Now when you execute the shortcut, it may still flash briefly on the taskbar but shouldn't flash a window on the screen.

  3. #3
    Administrator Rick Corbett's Avatar
    Join Date
    Dec 2009
    Location
    South Glos., UK
    Posts
    3,287
    Thanks
    150
    Thanked 876 Times in 710 Posts
    One of the quickest and easiest methods I know is to compile the BAT file using a tool that allows you to create a 'windowless' executable.

    For example, Slimm Bat to Exe
    hide-cmd1.png
    Click to enlarge

    or the more capable... Bat To Exe Converter
    hide-cmd.png
    Click to enlarge

    Whilst Slimm Bat to Exe offers fewer options, the compiled executables are tiny (~6 KB) compared to Bat To Exe Converter (~89 KB).

    I'm not going to provide a link to the second compiler's home page because MalwareBytes blocks what appears to be a bitcoin miner on the site and, in turn, the MalwareBytes blocking disables being able to download the Bat2Exe compiler. I ended up downloading it using a fresh VM then destroying the VM afterwards, just in case. If you DO want the second compiler then let me know and I'll provide an alternative link instead of its home page. (I've noticed several personal websites now include bitcoin miners but the decent ones advise you of this 'up front' and participation is entirely voluntary, unlike the Bat To Exe Converter website - F2KO Software).

    Note that ANY batch (or CMD/VBS/AHK/AU3) compiler is most likely to create executables that fail VirusTotal checks. I've been testing several BAT compilers in the last few weeks and have come to the conclusion that it's just the nature of the game. Even compiling the following innocuous 2-line BAT created a VirusTotal result of 22/65:

    Code:
    echo This is a test
    pause
    This means that you'll most likely have to manually exclude the resultant executable to prevent your own AV protection from disabling/deleting it. Such is the joy of modern-day 'heuristics' (or 'guesswork'... or just 'playing it safe').

    Hope this helps...
    Last edited by Rick Corbett; 2018-03-08 at 07:34.

  4. The Following User Says Thank You to Rick Corbett For This Useful Post:

    CWBillow (2018-03-07)

  5. #4
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,549
    Thanks
    35
    Thanked 214 Times in 190 Posts
    A minor point after all that is that NET USE can take /p:y or /p:n as abbreviations for persistent, yes, and no...

    I've had very little luck with BATch file compilers in the past, which have always turned out to be buggy*. Good luck if you can get one working!

    * even more so than Microsoft's Command Processor!
    Last edited by BATcher; 2018-03-08 at 03:30.
    BATcher

    Always advise against annoying, awkward and affected alliteration.

  6. #5
    New Lounger
    Join Date
    Dec 2009
    Location
    Brisbane Australia
    Posts
    15
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by CWBillow View Post
    I map my OneDrive to "O" and then auto logon in my startup.

    .......
    It works fine, but it flashes on the screen as it runs. Isn't there a way to run that file totally hidden?

    Chuck Billow
    Doesn't @echo off hide the scrolling text (if you insert it at the start)?

  7. #6
    Super Moderator bbearren's Avatar
    Join Date
    Dec 2009
    Location
    Polk County, Florida
    Posts
    4,021
    Thanks
    29
    Thanked 471 Times in 372 Posts
    Perhaps I'm missing something, but I don't use a batch file, I use OneDrive Settings to control its behavior. When I first setup OneDrive I moved the folder to A:/ and then opened Settings to set all the parameters, putting a check in the box beside "Start OneDrive automatically when I sign in to Windows".

    Why are you using a batch file?
    Create a fresh drive image before making system changes, in case you need to start over!

    "The problem is not the problem. The problem is your attitude about the problem. Savvy?"—Captain Jack Sparrow "When you're troubleshooting, start with the simple and proceed to the complex."—M.O. Johns "Experience is what you get when you're looking for something else."—Sir Thomas Robert Deware.
    Unleash Windows

  8. #7
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,579
    Thanks
    89
    Thanked 13 Times in 12 Posts
    For some reason I could't get the mapped drive to "take" as part of startup. It does with the batch file though.
    Chuck Billow
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

  9. #8
    Super Moderator bbearren's Avatar
    Join Date
    Dec 2009
    Location
    Polk County, Florida
    Posts
    4,021
    Thanks
    29
    Thanked 471 Times in 372 Posts
    Quote Originally Posted by CWBillow View Post
    For some reason I could't get the mapped drive to "take" as part of startup. It does with the batch file though.
    My setup is that OneDrive is only a folder on A:/ drive, which is just a logical drive of 500GB in my desktop PC. A:/ drive is not mapped; there's no need.
    Create a fresh drive image before making system changes, in case you need to start over!

    "The problem is not the problem. The problem is your attitude about the problem. Savvy?"—Captain Jack Sparrow "When you're troubleshooting, start with the simple and proceed to the complex."—M.O. Johns "Experience is what you get when you're looking for something else."—Sir Thomas Robert Deware.
    Unleash Windows

  10. #9
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,579
    Thanks
    89
    Thanked 13 Times in 12 Posts
    Maybe I'll try a version of that.

    Chuck
    Chuck Billow
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •