Giter Site home page Giter Site logo

silentcmd's Introduction

SilentCMD

SilentCMD executes a batch file without opening the command prompt window. If required, the console output can be redirected to a log file.

Download:SilentCMD_1.4.zip (7 KB)
Operating System:Windows 7 or newer
License:MIT

Command Line Syntax

SilentCMD [BatchFile [BatchArguments]] [Options]

Options:

   /? :: Show help
   /LOG:file :: Output status to LOG file (overwrite existing log)
   /LOG+:file :: Output status to LOG file (append to existing log)
   /DELAY:seconds :: Delay the execution of batch file by x seconds

Examples

SilentCMD c:\DoSomething.bat
SilentCMD c:\MyBatch.cmd MyParam1 /LOG:c:\MyLog.txt
SilentCMD c:\MyBatch.cmd /LOG+:c:\MyLog.txt
SilentCMD c:\MyBatch.cmd /DELAY:3600 /LOG+:c:\MyLog.txt

Use Cases

You can use SilentCMD for running batch files from the Windows Task Scheduler. With the tool you do not get interrupted by the command prompt window that normally would pop up.

You can call SilentCMD without parameters if required (e.g. when double-clicking it in Windows Explorer). In that case you have to specify the default parameters in SilentCMD.exe.config.

<setting name="DefaultBatchFilePath" serializeAs="String">
    <value>c:\temp\test.cmd</value>
</setting>
<setting name="DefaultBatchFileArguments" serializeAs="String">
    <value>arg1 arg2=xyz</value>
</setting>

silentcmd's People

Contributors

stbrenner avatar stephan-brenner avatar ymx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

silentcmd's Issues

Log file timestamps and other customization...

Is there a way to print the log timestamps in international format?

YYYY-MM-DD HH:MM:SS.ms (24 hr)

So that the timestamp is consistent regardless of user's OS region settings!

This also includes having leading zeros. so a time of 8:35:3.344 would be shown as 08:35:03.334. Again, this is for consistency in the timestamp format.


I would also like to see you skip a line (insert blank line) between each command that is run within the CMD/BAT script

And skip 2 lines at the end. So that if append mode is used, it is easier to see when the run occurs when scanning the log visually.


option to show duration time of CMD run in seconds. You can print this on a separate line right after : Finished "path\to\script.CMD"

Duration: 52.2531243 seconds. or HH:mm:ss,ms format might be good. Or both

Duration: 00:00:52.2531243 or 52.2531243 seconds.

Great program btw. Thank you.

Cannot find the file in the current directory when run elevated mode

When we only put filename, and run silentCMD under elevated mode (run as administrator), it cannot find the file.

<setting name="DefaultBatchFilePath" serializeAs="String">
      <value>test.bat</value>
</setting>

I have to change the Environment.CurrentDirectory + filename
become Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + filename.
Then it only able to find the file for both normal mode & elevated mode.

===
This is a great program. Thanks.

Injecting Admin Creds

In the config xml
How would you specify username and password ?

<setting name="DefaultBatchFileArguments" serializeAs="String">
    <value>username="admin"</value>
    <value>password="password"</value>
</setting>

Mention `start "" \path\SilentCMD` in the README to prevent cmd prompt from appearing

Would it be worth mentioning in the README that prepending SilentCMD with start "" can prevent the command prompt from appearing at all (source)? I found it useful for startup scripts.

Example: C:\Users\<USER>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\sshd-interactive-mode.bat:

start "" C:\Users\<USER>\bin\SilentCMD\SilentCMD.exe ^
"C:\Program Files\OpenSSH\sshd.exe" ^
-f C:\Users\<USER>\.ssh\sshd_config

start "" here prevents the cmd prompt from appearing on start. Without it the cmd prompt window lingers on the desktop even though the program exited.

But maybe it's obvious for more experienced windows users/admins.

Great utility by the way - thank you!

Task Scheduler

should SilentCMD.exe still be running in Task Manager after its done the thing I told it to do in Task Scheduler?

Similar cmd tool for PowerShell?

If you launch PowerShell from Task Scheduler (+ parameters) a console will flash for a moment even using "-WindowStyle hidden".
Do you know an equivalent of SilenCMD to hide PowerShell console completely?

SilentCMD new feature

SilentCMD [BatchFile [BatchArguments]] [Options]

Options:
/LOG:file :: output status to LOG file (overwrite existing log).
/LOG+:file :: output status to LOG file (append to existing log).
/DELAY:seconds ( delay the execution of BAT/CMD file by xxxx seconds )

Examples
SilentCMD c:\DoSomething.bat
SilentCMD c:\MyBatch.cmd MyParam1 /LOG:c:\MyLog.txt
SilentCMD c:\MyBatch.cmd /LOG+:c:\MyLog.txt
SilentCMD c:\MyBatch.cmd /DELAY:3600 /LOG+:c:\MyLog.txt

--- Very useful at boot for NET commands

Default logfile

When no log path is provided, SilentCMD should create a default log file under %temp%\SilentCMD.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.