# Running HyperDbg Script

Using command-line features

There are two ways to run batch-script like commands in HyperDbg.

First, we can save our command(s) in a file and then use the .script command, and the second way is to pass the `--script` argument to the hyperdbg-cli.exe.

In HyperDbg's batch scripts '`#`' is used as the comment character. However, in the script engine, it uses a C-like commenting style.

For example, let's assume that we saved the following lines in `c:\users\sina\desktop\script.txt`.

`# Test HyperDbg Script.connect local.logopen c:\users\sina\desktop\result.txt # Save the file at this locationload!syscall script { print(@rax); }sleep 5000pauseunload.logcloseexit`

Now, if we run HyperDbg, then we can .script command like this :

`HyperDbg> .script c:\users\sina\desktop\script.txt`

The second case is when we want to run our script from the command-line directly; then you can run the hyperdbg-cli.exe like this :

`Microsoft Windows [Version 10.0.18362.900](c) 2019 Microsoft Corporation. All rights reserved.​C:\Users\sina\Desktop\HyperDbg>hyperdbg-cli.exe --script c:\users\sina\desktop\script.txt`

With these two ways, we can automate our scripts in HyperDbg.