Jump to content

Using variables in scripts


Wannes Vande Wiele
 Share

Recommended Posts

Hello!

Recently I've been experimenting a bit using scripts that contain variables that the user should enter.
For example, a very simple one to shutdown a computer after X-amount of time: (example use-case:  I download large files during the night, so it doesn't count towards my ISP data-usage)

@echo off
set /p time=Enter time in seconds:
shutdown /s /t %time%
timeout /t 3 /NOBREAK
exit

however, upon executing said script, the app doesn't request for the variable to be filled out. (I guess it's not made for such uses)
Obviously, i can manually enter the command using CMD, but i don't want to be typing the command every time i need it. (you can call me lazy :p)

Any ideas how to do this correctly?

Edited by Wannes Vande Wiele
changed wording
Link to comment
Share on other sites

  • Administrators

You could have multiple versions of the script (Shutdown in an hour, shutdown in a day, etc) until we add support for variables. You could also give a try to this plugin:

-Paul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...