Reputation: 3103
I'm trying to define a command line program which will automatically call a specified Nodejs application.
I want to define it like that:
mycommand newFile
And that will call this application:
node E:/nodejsApp/mycommand.js newFile
mycommand.js
is ready now. I want to call it with directly mycommand
command on cmd in Windows 10.
Upvotes: 0
Views: 169
Reputation: 807
For that, create a batch file in your path (ex: C:\WINDOWS\System32) with that code:
node E:\nodejsApp\mycommand.js %1
Save it as the command you want to create + the batch extension ([command].bat
)
Another option will be, as aschipfl mentioned, use the doskey
command creating an autorun. Note that I recommend creating the batch file, as running a command at starting of CMD will slow down his starting.
For the AutoRun, create a registry key at HKCU\Software\Microsoft\Command Processor
called AutoRun
, type REG_MULTI_SZ
and write the value of doskey mycommand=node E:\nodejsApp\mycommand.js %1
Upvotes: 4