1

I'm here to ask you a very strange problem.

Right now i'm starting to work on Salesforce technology, in windows, and currently i follow the tutorial. When finally arrive to the terminal part, Windows come out to create problem...

I state that I am using the terminal of Git Bash Here (MinTTY)

$ sfdx force:data:record:create -s Account -v "Name='Hilton Union Square' BillingStreet='333 O Farrell St' BillingCity='San Francisco' BillingState='CA' BillingPostalCode='94102' Phone='(415) 771-1400' Website='www.hilton.com'"
"C:\Program" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

More in general, the problem comes out every time there are Quote in the argument:

$ sfdx ""
"C:\Program" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

opposite to:

$ sfdx
Salesforce CLI

VERSION
  sfdx-cli/7.157.0 win32-x64 node-v16.15.1

USAGE
  $ sfdx [COMMAND]

TOPICS
  alias    manage username aliases
  auth     authorize an org for use with the Salesforce CLI
  config   configure the Salesforce CLI
......

I try almost every thing: alias, Path, Full Path, Short Path, Quote, ... this is my current path:

PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/A409806/bin:/c/Program Files/Common Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files (x86)/WindowsPowerShell/Scripts:/cmd:/c/Program Files/nodejs:/c/Users/A409806/AppData/Local/Microsoft/WindowsApps:/c/Program Files/sfdx/bin:/c/Users/A409806/AppData/Roaming/npm:/c/Users/A409806/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/A409806/AppData/Local/JetBrains/Toolbox/scripts:/usr/bin/vendor_perl:/usr/bin/core_perl

Please, someone help me, i suppose is MinTTY problem, but i can't immage how solve it.

Thanks agane

8
  • 1
    Try replacing the spaces in the file path with %20 or similar?
    – Phil W
    Commented Jul 8, 2022 at 10:35
  • BTW, I voted to close since this is not specific to Salesforce but rather to your environment.
    – Phil W
    Commented Jul 8, 2022 at 10:35
  • I disagree with the close vote. It's about getting sfdx to run. We wouldn't close something about getting LEX to work in IE11 because IE11 isn't part of Salesforce, would we? There are going to be some non-Salesforce components to questions, and if Salesforce is meaningfully involved (and I'd argue sfdx is "meaningfully involved") then this is the right place for it.
    – Derek F
    Commented Jul 8, 2022 at 11:50
  • 1) Usually, "C:\Program" is not recognized... errors are because the folder is C:\Program Files and some full-path command is not surrounded by quotation marks, so the space between 'Program' and 'Files' causes the command interpreter to stop and assume that the command is just C:\Program. 2) Your PATH values do not look like Windows PATH values, so I assume those are the values as you view them from within MinTTY. Why are trying to run SF CLI on Windows and using a Unix terminal emulator? It seems to me that is introducing too many variables - especially when you are trying to learn SF.
    – Moonpie
    Commented Jul 8, 2022 at 12:51
  • I'm having the same problem but for a different reason. sfdx is running fine unless one of my parameters contains spaces and is surrounded by quotes, as in: sfdx force:source:deploy --verbose -u alias -m "Profile:My Too Long Profile" That invocations complains. Perhaps not strictly an sfdx command issue--but certainly a challenge running it in git-bash.
    – tggagne
    Commented Jan 18, 2023 at 1:50

3 Answers 3

1

After a lot of try, Finaly i SOLVE the problem on windows (over MinTTY). The solution is change installation path:

  1. Uninstal current Installation of Salseforce
  2. Instal agane the sfdx-x64.exe but select another install directory, in my case i create another one called C:\SalsesforceTool
  3. Do all the other thinks normally

At the end of the process try on terminal the problem command, this is my output:

10:34:26 ~/Desktop
└─▶ $ sfdx ""
 »   Warning:  is not a sfdx command.
Did you mean help? [y/n]: n

 »   Error: Run sfdx help for a list of available commands.

Now all is fine :D

Thanks to every one for the help

0

Use Powershell instead. As per Salesforce Docs:

Salesforce CLI works best within the native Windows command prompt (cmd.exe) and the Microsoft Windows PowerShell. We don’t recommend using Salesforce CLI with a Linux terminal emulator, such as Windows 10 Subsystem for Linux, cygwin, or MinGW, because support for bugs is limited.

1
  • In my case, unfortunately, I had no other choice. Anyway, as you can see I fixed it and uploaded the solution some time ago.Since then I have had no more problems, in my opinion their warning is only to not take responsibility. Commented Aug 27, 2023 at 8:09
-1

When you install SFDX CLI on windows, the PATH variable is automatically set by SFDXL CLI Installer.

I will suggest to do below things.

  1. Uninstall SFDX CLI from windows system.
  2. Remove any environment variable you set for SFDX CLI.
  3. Restart the system.
  4. Try installing SFDX CLI latest version with all default values.

If you still face issue about "C:\Program" is not recognized as internal or external command then append in PATH variable as below,

C:\Progra~1\sfdx\bin

You can change sfdx\bin part depending upon your installation path.

C:\Progra~1 is equivalent to C:\Program Files

Edit

What you are trying to execute with command sfdx " " ?

Can you share what you have in your PATH environment variable ?

1
  • As I understand it, the "~1", "~2", etc. are determined according to alphabetical order, so "C:\Progra~1 is equivalent to C:\Program Files" only if you do not have a folder that starts with 'Progra' and is ahead of 'Program Files' in alphabetical order. (E.g., you have a folder on the C drive named 'Prograde' or 'Program Data' or even just 'Program'.)
    – Moonpie
    Commented Jul 8, 2022 at 12:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .