# CutePDF command line or equivilant

Is it possible to run a command that will automatically print to file using CutePDF?

I have tried this and still no luck: print C:\test.doc /D:CPW2

If not any other suggestion on how to automate a print to pdf / convert to pdf through a command line silently (freeware)

-
What kind of files are they? The program used to display, edit, and print the file will determine what terminal command should be used, if the command exists at all. –  daxlerod Jul 3 '13 at 12:34
what error message do you get? –  golimar Jul 3 '13 at 12:50
Do you need a specific output path or could it be the same path as the input path is? For example print C:\test.doc would create a new PDF file under C: –  nixda Jul 3 '13 at 12:59
The path doesn't really matter, would prefer it to be the same as the input but that can be changed accordingly, the error im getting is: "Unable to initialize device CPW2" Although in printers this is the correct port. Im not sure whether its something to do with cutepdf itself –  Ash King Jul 3 '13 at 13:06
@AshKing Hello, I would be pleased if you could leave some feedback to know if I have to improve my answer. –  nixda Aug 17 '13 at 9:09

### Simple solution

If the output path doesn't matter, you could try PDFCreator with the following commandline:

C:\Program Files (x86)\PDFCreator>PDFCreator.exe /NOSTART /PF"C:\test.doc"

1. Per GUI you have to enable Use Auto-save and set a auto-save path once.
From now on, this path will be used every time you execute the command above
2. You have to set PDFCreator as your default printer

Tip:
Per GUI you can save your settings in a profile (.INI file) which can then be selected when you execute your command line. This way, you don't have to use Auto-save as default for every normal print (e.g. from Word or Excel). Read here for more about PDFCreators commandline usage

PDFCreator.exe /NoStart /OptionsFile"C:\myprofile.ini" /PF"C:\test.doc"


The advantage of the second solution is, that you don't have to set PDFCreator as your default printer and you have full control over the output file path and name

1. Install PDFCreator together with its COM module

2. Copy & paste this code to a textfile and save it as Convert2PDF.vbs

Set PDFCreator = Wscript.CreateObject("PDFCreator.clsPDFCreator", "PDFCreator_")
With PDFCreator
.cStart "/NoProcessingAtStartup"
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveFormat") = 0
.cOption("AutosaveStartStandardProgram") = 0
DefaultPrinter = .cDefaultprinter
.cDefaultprinter = "PDFCreator"
.cClearcache
.cPrinterStop = false
.cOption("AutosaveDirectory") = WScript.Arguments(1)
.cOption("AutosaveFilename") = WScript.Arguments(2)
.cPrintfile cStr(WScript.Arguments(0))
c = 0
Do While (ReadyState = 0) and (c < 120)
c = c + 1
Wscript.Sleep 250
Loop
.cDefaultprinter = DefaultPrinter
.cClearcache
WScript.Sleep 200
.cClose
End With


Convert2PDF.vbs "C:\input.doc" "C:\outputfolder" "outputfilename"
Personally I use a slightly different version where the input and output folder+filename stays the same. I created a shortcut in my shell:sendto folder to easily convert files per right-click