简体   繁体   中英

How To Automatically run a powershell cmd on a specific folder on windows 10 start up after a delay (30s)

We are using web project unfinished, and everytime the computer start, we need to go to:

c:/wamp64/www/

In this folder we have a folder "projectname", we have to shift right click, and open powershell windows here.

then we have in the terminal: PS C:\wamp64\www\projectname> (and here we have to write "node server.js") and enter.

This have to be done once wamp is open, this is the reason of the delay.

How can we do that automatically at windows start up after 30s? that way we won't have to do that every time we reboot a computer.

thank you for your help

I would use the task scheduler for that purpose.

  • Open Task Scheduler by pressing “Windows+R” and then typing “taskschd.msc” in the window that opens. Then take the following steps:
  • Click “Create a task” and enter a name and description for the new task. To run the program with administrator privileges, check the “Run with the highest privileges” box.
  • Switch to the Triggers tab and click the “New…” button. Here you can specify the conditions that trigger the task to be executed. For example, you can have it executed on schedule, at logon, on idle, at startup or whenever a particular event occurs. 任务调度器
  • Choose At log on then set it to run for Any user and set the delay to 30 seconds
  • Navigate to the “Actions” tab, and click “New…”. To schedule the PowerShell script, specify the following parameters:
      Action: Start a program
      Program\script: powershell
      Add arguments (optional): -File [Specify the file path to the script here]

References

How to automate powershell scripts with task scheduler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM