26

In my application directory (on Windows) I run:

sudo pdfkit --install-wkhtmltopdf

as explained here, but I got this error:

'sudo' is not recognized as an internal or external command, operable program or batch file.

What could be the problem ?

Mosh Feu
  • 28,354
  • 16
  • 88
  • 135
Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746

10 Answers10

55

Sudo is a Unix specific command designed to allow a user to carry out administrative tasks with the appropriate permissions.

Windows does not have (need?) this.

Run the command with the sudo removed from the start.

Douglas F Shearer
  • 25,952
  • 2
  • 48
  • 48
  • 1
    I tried to run `pdfkit --install-wkhtmltopdf` but now the `pdfkit` command is not recognized. `gem list` shows that I do have the `pdfkit` gem installed. Any ideas ? – Misha Moroshko Mar 03 '11 at 00:21
  • It sounds like PDFkit is not in your PATH. Try navigating to the gem directory and running it from there. – Douglas F Shearer Mar 17 '11 at 14:45
10

sudo is a Unix/Linux command. It's not available in Windows.

dnch
  • 9,565
  • 2
  • 38
  • 41
5

sudo is used for Linux. It looks like you are running this in Windows.

skaz
  • 21,962
  • 20
  • 69
  • 98
4

That you are running Windows. Read:

http://en.wikipedia.org/wiki/Sudo

It basically allows you to execute an application with elevated privileges. If you want to achieve a similar effect under Windows, open an administrative prompt and execute your command from there. Under Vista, this is easily done by opening the shortcut while holding Ctrl+Shift at the same time.

That being said, it might very well be possible that your account already has sufficient privileges, depending on how your OS is setup, and the Windows version used.

Jim Brissom
  • 31,821
  • 4
  • 39
  • 33
1

sudo is a command for Linux so it cant be used in windows so you will get that error

Ram kumar
  • 11
  • 1
0

Sudo is a Unix specific command designed to allow a user to carry out administrative tasks with the appropriate permissions. Windows doesn't not have (need?) this.

Yes, windows don't have sudo on its terminal. Try using pip instead.

  1. Install pip using the steps here.
  2. type pip install [package name] on the terminal. In this case, it may be pdfkit or wkhtmltopdf.
Ramzs
  • 28
  • 7
0

Analogue to sudo in Windows is running command prompt "As Administrator" by right-clicking on it's link. Then everything you run in it will be "sudo-ed".

ScienceDiscoverer
  • 205
  • 1
  • 3
  • 13
0

sudo is not for windows, its for unix/linux.

option 1: install ubuntu cli software (not OS) in windows, here is the windows store link: https://www.microsoft.com/en-in/p/ubuntu-2004/9n6svws3rx71. After installing you can use ubuntu's cli in your windows where sudo will work.

option 2: install and use gem (ruby on rails) for installing wkhtmltopdf-binary gem install pdfkit gem install wkhtmltopdf-binary

ref: https://github.com/pdfkit/pdfkit

option 3: you can use npm or python for wkhtmltopdf insted of ruby on rails, both modules (nodeJS python) works fluently and compatible with windows:-

https://www.npmjs.com/package/wkhtmltopdf

https://pypi.org/project/wkhtmltopdf/

aakash4dev
  • 774
  • 4
  • 13
0

Windows itself doesn't support sudo. However, with gsudo installed you can have this functionality. Running sudo in this case will call out a UAC prompt.

enter image description here

Yeoman
  • 51
  • 5
0

Install sudo from powershell in windows.

Step 1:

Open Windows Powershell

Step 2: Set Execution Policy

> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Step 3: Install scoop

>iex "& {$(irm get.scoop.sh)} -RunAsAdmin"

Step 4: Install sudo command

> scoop install sudo

Step 5: Congrats Sudo installation done check with one basic command

>sudo`enter code here`