I can't create a global gitignore in my terminal. touch ~/.gitignore gives an error - cmder

I am trying to create a global .gitignore file with this command:
touch ~/.gitignore
but in my terminal (Cmder) gives this message: "touch: cannot touch '~/.gitignore': No such file or directory"
I have changed to windows terminal default (Command Prompt) and it says:
"'touch' is not recognized as an internal or external command, operable program or batch file."
What I am doing wrong or what can I do to solve this?

You are using linux syntax. Now, even though touch is not understood by cmd prompt, it is a command understood by cmder but expression ~/.gitignore is still linux way of saying things.
What you can do on cmd prompt, I guess also would work on cmder (edit: doesn't seem to work for cmder):
copy con "%USERPROFILE%\.gitignore"
[press F6 and enter after that]
For cmder, this could work:
touch "%USERPROFILE%\.gitignore"

This should help for windows terminal:
echo $null >> pot.txt
touch is linux command not windows command.
Below question should help a lot more :
https://superuser.com/questions/502374/equivalent-of-linux-touch-to-create-an-empty-file-with-powershell

Related

Trying to run the command 'appium-doctor' on Windows Command Prompt but getting an error

I installed Appium Desktop for windows and used the Command Prompt to install Appium server and appium-doctor via npm but I get the following error after typing 'appium-doctor' in the command prompt:
'appium-doctor' is not recognized as an internal or external command, operable program or batch file.
How can I get appium-doctor to run?
Edit: I found out what was wrong. In %PATH%, I had two variable locations written down in the same line separated by a semicolon:
C:\Users\xyz\AppData\Roaming\npm;C:\Program Files\nodejs
I removed the semicolon and put the two variable locations in different lines:
C:\Users\xyz\AppData\Roaming\npm
C:\Program Files\nodejs
Everything is working now
you either need to specify the full path in cmd, or add the path to the executable in your os PATH environment variable

"code ." command stopped working from Ubuntu bash shell for Windows 10

I have WSL on Windows 10, and I used to be able to open a folder in VS Code from the Ubuntu bash shell using the command "code ." but this stopped working.
I double checked that "C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin" was added to my PATH, but it is still not working. Also, the VS Code command palette does not give me the option to install Shell Commands like I saw in other answers for people who were having the same problem with Mac OSX.
I really like the feature of being able to open a folder from command line -- is there a fix to this, or perhaps even a workaround?

PsExec is not recognized as an internal or external command

I have a job that needs to run a script on a remote computer. I'm doing so by using psexec via "Execute windows batch command":
C:\PsExec.exe \\computername -u username -p password -accepteula c:\xxx.exe
When I run the job I get the following error:
c:\PsExec.exe is not recognized as an internal or external command
** PsExec.exe is located under c:\
Any ideas?
First Define psexec.exe path in environment varaiable "PATH" or else place psexec.exe file in C:\Windows\System32\
And to Download Psexec.exe file
https://download.sysinternals.com/files/PSTools.zip
One possible explanation is the version of PsExec.exe: 32bits or 64bits.
If you have the 32 one on a 64bits machine, that command would not be recognized indeed. PsExec64.exe would.
I can see the age of this question and my answer may not be relevant to this topic since I was technically trying to solve a different problem, but maybe this will help other people who are stuck.
c:\PsExec.exe is not recognized as an internal or external command
I was trying to disable the Maintenance Configurator with PSExec (my problem is the never ending maintenance bug) and kept running into the same error as the OP BUT I got PSexec64 to run this command:
C:\PsExec64.exe -s schtasks /change /tn >"\Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE
BY checking the "Run this program as an administrator" option under the Compatibility settings for "PsExec64.exe"
Don't know if this has solved my problem yet, but I think the OP would have been able to run his process if he had done this. Dear OP did you ever solve that?

ImageMagick, "which" is not recognized as an internal or external command

I just installed ImageMagick on my windows machine so I can use it with the paperclip gem with RUby on Rails. When I try to run "which convert" into the command prompt, it returns a 'which' is not recognized as an internal or external command,
operable program or batch file.
I am relatively new to command prompt and still trying to learn as much as I can. What is wrong with my command and how do I fix it?
The command is right. The OS is wrong.
which is a unix command not a windows one.
See the equivalent Windows command
Just use the following command on Windows:
where package_name

rubys> cd command not working in command line

I'm just getting into ruby and am trying to execute a walkthrough from Sam Ruby's Agile web development.
I've created a directory using mkdir work
Next i'm instructed to open a terminal and type rubys> cd work
The error I'm getting reads:
No command 'rubys' found, did you mean:
Command 'ruby' from package 'ruby' (main)
rubys: command not found
Can anyone inform me of what I'm doing wrong?
I've also tried changing from ~ to the work directory before entering my command.
In this book, rubys> is a command prompt, much like you have C:\> in the Windows terminal.
Ignore that first bit and everything should start working.
I guess you're doing it wrong.
mkdir work
creates a directory called "work". It has nothing to do with Ruby.
cd work
will then change into that directory. Forget about the rubys>.

Resources