Batch File
Upon running a batch file that i created i get the following error " Too many command-line parameters"
Can someone fix this for me? Thanks in advance
REG ADD "HKCR\http\shell\open\command" /v "(Default)" /T REG_SZ /D "c:\Program Files\Mozilla Firefox\firefox.exe" -requestPending -osint -url "%1" /f
Can someone fix this for me? Thanks in advance
REG ADD "HKCR\http\shell\open\command" /v "(Default)" /T REG_SZ /D "c:\Program Files\Mozilla Firefox\firefox.exe" -requestPending -osint -url "%1" /f
0 Comments
[ + ] Show comments
Answers (7)
Please log in to answer
Posted by:
bearden3
14 years ago
Hi.
You have too many double quotes for the syntax. To put a double quote inside the data, you need to use the \" sequence. Try this instead of what you wrote:
REG ADD HKCR\http\shell\open\command /v (Default) /T REG_SZ /D "\"c:\Program Files\Mozilla Firefox\firefox.exe\" -requestPending -osint -url "\"%1\"" /f"
This should give you a (Default) key with:
"c:\Program Files\Mozilla Firefox\firefox.exe" -requestPending -osint -url "%1" /f
You have too many double quotes for the syntax. To put a double quote inside the data, you need to use the \" sequence. Try this instead of what you wrote:
REG ADD HKCR\http\shell\open\command /v (Default) /T REG_SZ /D "\"c:\Program Files\Mozilla Firefox\firefox.exe\" -requestPending -osint -url "\"%1\"" /f"
This should give you a (Default) key with:
"c:\Program Files\Mozilla Firefox\firefox.exe" -requestPending -osint -url "%1" /f
Posted by:
chichora123
14 years ago
Posted by:
bearden3
14 years ago
Posted by:
bearden3
14 years ago
The %1 is a parameter that passes values from the command line. So, since you are running the batch file, it is looking for something from the command line to replace %1 with (which would be the first string after the batch file name). Since there is nothing on the command line (or if you are just double-clicking the batch file), it is using NULL, hence the blank double quotes ("") at the end.
So, unless you are going to run the batch file and pass a literal string of "%1" to your command line, a batch file probably isn't going to work for you. You might need to go the route of a VBScript instead.
So, unless you are going to run the batch file and pass a literal string of "%1" to your command line, a batch file probably isn't going to work for you. You might need to go the route of a VBScript instead.
Posted by:
aogilmor
14 years ago
I don't see bat files much these days although I can understand their appeal for non-programmers. for me vbscript was a steep learning curve, but scriptomatic was a lifesaver. And all the free code out there. But now they say vbs is outmoded and powershell is the coming script language. c# would be good to know too.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.