I am looking for a short command which I can execute in the Windows 10 command shell (cmd
) or in powershell
or in git-bash
for Windows, which would replace PATH Environment variable
items to double quote those which have spaces?
The actual problem I face is that when I type a command in git-bash
$ sfdx force:org:create -s -f config/project-scratch-def.json -a "default scratch org"
I receive an error
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
I think this error happens because
sfdx
tool is located in "C:\Program Files\Salesforce CLI\bin" and it should be probably double quoted in path if I am not wrong.
So when I execute path
command in cmd
I see
D:\Git\SFDX\MySFDXProject>path
PATH=C:\Python27\;C:\Ruby23\bin;C:\Program Files\Salesforce CLI\bin
so I guess C:\Program Files\Salesforce CLI\bin
should be double quoted in path but I want mass double quote any path items which have spaces in path so that any other command won't fail.
So if my path is C:\Python27\;C:\Ruby23\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Salesforce CLI\bin
I want it to be transformed by command into C:\Python27\;C:\Ruby23\bin;"C:\Program Files\Microsoft VS Code\bin";"C:\Program Files\Salesforce CLI\bin"
and to be saved in PATH environment variable.
How do I do that?
$sfdx force:org:create -f project-scratch-def.json -a MyScratchOrg<ENTER>
bash
does not use the same path format as Windows. See stackoverflow.com/questions/13701218/…