Why are my arguments Invalid?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Why are my arguments Invalid?

#16 Post by penpen » 19 Apr 2016 09:32

If i execute the lines one by one, then the result is similar to yours:
- "The arguments are invalid":

Code: Select all

rundll32 printui.dll,PrintUIEntry /ia /m "Ricoh Aficio MP C6000 PS" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf"
As kwsiebert mentioned using the base parameter "/F" could be an error; for details see:
https://technet.microsoft.com/de-de/library/ee624057(v=ws.10).aspx.

- "Operation could not be completed (error 0x00000705) ..."

Code: Select all

rundll32 printui.dll,PrintUIEntry /if /b "BH Dockside Color" /F "\\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf" /r "IP_192.168.141.20" /m "Ricoh Aficio MP C6000 PS"


Sidenote:
I'm not firm with this, but you may need to add the specified driver package to the driver store before you could install the driver:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff550419(v=vs.85).aspx.
Syntax:
https://technet.microsoft.com/de-de/library/ff800798(v=ws.10).aspx.

In addition this may (if that is your issue; but you first should test out the parameters) help you (but i hope for the best):
https://social.technet.microsoft.com/Forums/windows/en-US/ea0f6b15-4bad-40a8-8f35-5c7993703ceb/printuidll-printer-install-driver-issues?forum=w7itprogeneral.


penpen

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Why are my arguments Invalid?

#17 Post by wchristner » 20 Apr 2016 09:18

Thanks Again Pen Pen
I have decided to go with cscript option.

Code: Select all

cscript %WINDIR%\system32\prnport.vbs -a -r IP_192.168.141.20 -h 192.168.141.20 -o raw -n 9100
cscript %WINDIR%\system32\Prndrvr.vbs -a -m "Ricoh Aficio MP C6000 PS" -i \\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf -h
cscript %WINDIR%\system32\Prnmngr.vbs -a -p "BH Dockside Color" -m \\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf" -r IP_192.168.141.20


Now I just need to figure out what argument are correct/incorrect

I use robocopy to copy all drivers and .vbs scripts to local system 32 folder

Code: Select all

echo Copying Drivers to your Computer
echo This will take a moment
echo************************************
@echo.
robocopy "\\bh-miworks-srv2\PrintDrivers\Drivers\spool\drivers" "C:\Windows\System32\spool"
robocopy "\\bh-miworks-srv2\PrintDrivers\Printing_Admin_Scripts\en-US" "C:\Windows\System32"
pause

no the only error I see is this

pt1
Image


pt2
Image


Thanks to everyone and to PenPen

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Why are my arguments Invalid?

#18 Post by penpen » 21 Apr 2016 04:34

1) Don't copy external files to your windows installation directories, until you exactly know what you are doing.
There are several possible issues.
So if you want to copy files to your system, then use an own non-system directory, that is not accessable for other users.
Maybe create "%temp%\deploy\printerXY\", or something like that, and don't forget to delete it after finished.

2) Check if the files you want to use are already present on the target system, and if existing use them:
The "prnport.vbs", "prndrvr.vbs", and "prnmngr.vbs" files should located at "%windir%\System32\Printing_Admin_Scripts\de-DE".
Note that "de-DE" is a Language Culture Name used by my system:
Use the Language Culture Name of your target systems (i assume it is "en-US", but i may error).

3) I assume (on a first look):
- the "cscript %WINDIR%\system32\Prndrvr.vbs ..." line fails, because you are using the option "-h" without the path.
- the "cscript %WINDIR%\system32\Prnmngr.vbs ..." line fails, because the the driver model you've specified with "-m \\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf"" is simply wrong;
in addition a single doublequotes character is another error

I've googled some howto's, these seem to work (on my win8.1 system using my printer - i don't have win10, so there is no guarantee):
- rundll32 verison: http://jacobsalmela.com/manage-windows-printers-command-line/
- vbs verison: http://woshub.com/manage-printers-and-drivers-from-the-command-line-in-windows-8/

You should also do everything step by step:
Get the first line of your script run properly.
If no error occures, proceed with the next line, and so on.

Sidenote:
You could copy a selection of the cmd window to the clipboard by right-clicking your cmd-window,
select "mark",
push the leftmouse button, move the mouse and release the mouse button, then press the "enter"-key.
Paste it using ctrl+V within a codeblock, so you don't need to load up images.


penpen

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Why are my arguments Invalid?

#19 Post by wchristner » 21 Apr 2016 14:08

Many Thanks PenPen! I will give your suggestions a shot.
You are correct I am in the US, Good to meet you.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Why are my arguments Invalid?

#20 Post by foxidrive » 22 Apr 2016 03:15

Good luck with this wchristner.

My reply has nothing to do with your task - I just want to comment that every time I read this thread title I have a bit of a smile. It's the sort of thing that people would accuse my verbal arguments of. :D

Compo
Posts: 600
Joined: 21 Mar 2014 08:50

Re: Why are my arguments Invalid?

#21 Post by Compo » 22 Apr 2016 07:36

wchristner wrote:I have decided to go with cscript option.

Code: Select all

cscript %WINDIR%\system32\prnport.vbs -a -r IP_192.168.141.20 -h 192.168.141.20 -o raw -n 9100
cscript %WINDIR%\system32\Prndrvr.vbs -a -m "Ricoh Aficio MP C6000 PS" -i \\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf -h
cscript %WINDIR%\system32\Prnmngr.vbs -a -p "BH Dockside Color" -m \\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf" -r IP_192.168.141.20


Now I just need to figure out what argument are correct/incorrect

I've noticed you're using a UNC for your inf location, even if that is supported I'm sure your space in that path would be a problem!

cscript %WINDIR%\system32\Prndrvr.vbs -a -m "Ricoh Aficio MP C6000 PS" -i "\\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf" -h
cscript %WINDIR%\system32\Prnmngr.vbs -a -p "BH Dockside Color" -m "\\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf" -r IP_192.168.141.20

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: Why are my arguments Invalid?

#22 Post by wchristner » 27 Apr 2016 12:08

My Code

Code: Select all

cls
@echo   Copying Drivers to your Computer
@echo      This will take a moment
@echo ************************************
MKDIR %temp%\deploy
@echo.
xcopy /Y "\\bh-miworks-srv2\PrintDrivers\Printing_Admin_Scripts\en-US" "%temp%\deploy"
xcopy /Y "\\bh-miworks-srv2\PrintDrivers\Drivers\Ricoh MP6501\Win 10\oemsetup.inf" "%temp%\deploy"
@echo.
echo Done Copying Files
pause



cls
@echo  #######################################################################
@echo #                                                                       #
@echo #                         *Kinexus*                                     #
@echo #                                                                       #
@echo # This will Install Ricoh color Dockside printer on your computer.      #
@echo # Once you click OK, it will run. It may take a minute to install.      #
@echo # During that time you will see no screen activity until it finishes.   #
@echo # Installing Printer.... please wait                                    #
@echo.#                                                                       #
@echo  #######################################################################
@echo.
cscript "%temp%\deploy\Prndrvr.vbs" -a -m "RICOH Aficio MP C6501 PCL 6" -v 2 -e "Windows NT" -i "%CD%" "%temp%\deploy\oemsetup.inf" -h "%CD%" "%temp%\deploy
cscript "%temp%\deploy\prnport.vbs" -a -r IP_192.168.141.20 -h 192.168.141.20 -o raw -n 9100
cscript "%temp%\deploy\Prnmngr.vbs" -a -p "BH Dockside Color" -m "RICOH Aficio MP C6501 PCL 6" -r "IP_192.168.141.20"
@echo.
@echo.
@echo  =====================================================================
@echo =                                                                     =
@echo =                         *Kinexus*                                   =
@ECHO =   Installation of the Ricoh printer has completed!                  =
@echo =   If you have any problems, please contact IT.                      =
@echo =                                                                     =
@echo  =====================================================================
pause
exit


My Error
Image

bueller....bueller....I am still trying to figure out how to install this printer via tcp ip. I looks like the .inf file is the trouble.
I know nobody outside my environment can run this code but if you have had this error and solved it, What did you do?

Thanks

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Why are my arguments Invalid?

#23 Post by penpen » 29 Apr 2016 03:27

First: Please don't use images for cmd.exe output, as i've written in my last post.
If it wasnt't clear what i've written, then see this:
https://www.youtube.com/watch?v=4WU2_2ZqkkU

wchristner wrote:....I am still trying to figure out how to install this printer via tcp ip. I looks like the .inf file is the trouble.

When reading the error message (in this case this seems to be the help screen), you see that actually the inf file is not causing the trouble.
(It may be that it will cause trouble once it accepts the command line arguments you are using.)

This line is causing the trouble:

Code: Select all

cscript "%temp%\deploy\Prndrvr.vbs" -a -m "RICOH Aficio MP C6501 PCL 6" -v 2 -e "Windows NT" -i "%CD%" "%temp%\deploy\oemsetup.inf" -h "%CD%" "%temp%\deploy

The causes i see are:
1) The environment (switch: -e) "Windows NT" is unknown.
Your vbs-script says it only allows "Windows {NT x86 | X64 | IA64}". This is a regular expression that accepts the following names:
"Windows NT x86", "Windows X64", and "Windows IA64".
This switch should only be used if a driver for one system (for example the 32 bit driver) should be used to install it on another system (for example 64 bit);
the version switch (-v) also should be used only in multiple systems environments.

2) The fully quallified inf file name (switch: -i) is invalid ("%CD%"), and the string after that is an unknown command line argument ("%temp%\deploy\oemsetup.inf"):
I guess you wanted to use "%temp%\deploy\oemsetup.inf" only.

3) The driver file path (switch: -h) probably is wrong ("%CD%" expands to "C:\windows\system32").
In addition i think it is not needed, when the drivers are located in the same path as the inf file (package), but that's only a guess.

I cannot know if the other values are valid, but i first assume it, so try this command line:

Code: Select all

cscript "%temp%\deploy\Prndrvr.vbs" -a -m "RICOH Aficio MP C6501 PCL 6" -i "%temp%\deploy\oemsetup.inf"


penpen

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Why are my arguments Invalid?

#24 Post by foxidrive » 05 May 2016 11:03

wchristner wrote:My Code

Code: Select all

cls
@echo   Copying Drivers to your Computer
@echo      This will take a moment



Was penpen able to help you here?

Post Reply