Run on windows startup CMD with arguments

2019-09-05 23:46发布

For some reason I need to run CMD on windows startup. I need to run CMD with arguments. Is it possible to do via registry key?

I am trying the

    "parameter"="\"C:\\Windows\\System32\\cmd.exe\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\parameter]

But how can I add arguememnts to it, if that's possible?

I made this simple task "C:\Windows\System32\cmd.exe /c notepad.exe" But dont have notepad to be run by cmd. What can be the reson?

Can I be missing something? I have made two records 1 in HKLM / RUN/ "C:\Windows\System32\cmd.exe /c notepad.exe" 2 in HKEY_CURRENT_USER/ RUN the same record "C:\Windows\System32\cmd.exe /c notepad.exe" But the cmd doesnt start notepad

2条回答
时光不老,我们不散
2楼-- · 2019-09-06 00:12

Your example has the lines in the wrong order for a *.reg file. The following should work:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"Terminal"="C:\\Windows\\system32\\cmd.exe /c parameter1 parameter2 parameter3 ..."

This will only run once on bootup. If you want to run every time you log in, then you need to change it to:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"Terminal"="C:\\Windows\\system32\\cmd.exe /c parameter1 parameter2 parameter3 ..."
查看更多
Emotional °昔
3楼-- · 2019-09-06 00:18

from CMD you can Run this

REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /t REG_SZ /d " "

or manually you can go to this structure and string value

查看更多
登录 后发表回答