cd %C^ in command promt? [closed] - cmd

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I khow im a bit off topic because posting here,but this is prety weird.
i were just testing cmd,when i enter this command:cd %C^
it show :
"more?"
"more?"
"The system cannot find the path specified."
this is weird because it is showing "more?",so i have tried researching on the internet,but found thin air.
screenshot:
https://imgur.com/a/kiZIECy
is this normal?

"More?" means the cmd is asking you to continue your command.
"^" is an escape character when you use this character the cmd does not just runs whole command and shows you the result but instead it breaks the command in parts that it will run as you press enter key when it says "more?" it asks you if you want to run the next part of the command and at the end it reaches at the same result as writing a command as "cd %C".
if you have used linux you can see this type of interpretation when you open a large file using cat(a file reading function in bash that prints out the text file as you press enter).

Related

Alternative to Ctrl-R reverse search in bash [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
The community is reviewing whether to reopen this question as of 4 days ago.
Improve this question
I am happy and really like the Ctrl-R backward search feature of the bash shell. Some of my colleagues don't like it, since it is sometimes confusing. I understand them. If you enter the wrong characters, the current position in the history is somewhere in the past, and you won't find the recent matches.
Is there a more user friendly alternative for seaching backward in the shell history?
I want to stick with bash. Suggesting an alternative shell is not an answer to this question.
The issue with the "lost position" is explained here: Reset bash history search position These solutions work. That's right. But the solution there are not easy and user friendly according to my point of view. These solutions are not simple and straight forward. These are solutions of the past. In the past the human needed to learn the way the computer wanted the input. But today the tools should accept the input in a way which is easy for the user.
You can also use history-search-backward. It's not bound to any key by default, so you need to add
"\eq": history-search-backward
to your ~/.inputrc. Then you can type a prefix of the command you want to find in the history, e.g.
cd /l
then press Alt+q and the shell will expand it to
cd /last-visited-dir
Pressing the key combination again will search for a previous mention, etc.
If you type the wrong characters to search for, press Ctrl-G to stop the search and then Ctrl-R and the correct characters to restart the search.
You can also set up Ctrl-S to reverse the direction of the search in case you entered the correct search characters but went to many steps backward. The Ctrl-S allows you to go forward. To enable this, you will need to add:
stty -ixon
to your Bash startup file.
That command turns off the default flow control function of Ctrl-S and Ctrl-Q and makes those key combinations available for other uses. In Bash by default Ctrl-S is used for history search and Ctrl-Q is a duplicate of Ctrl-V which performs quoted insert (e.g. pressing Ctrl-V Enter results in ^M being inserted as a representation for the single character for Return).
And you might need to add:
"\C-s": forward-search-history
to your ~/.inputrc.
Piping history through grep gives you a "less interactive" way to interface with the history buffer, but sometimes less interactive is what you need.
You can re-execute a specific numbered command from the grep output with !number

Batch file appears not to run and shuts down immediately [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am trying to run a batch file with the following code:
set dirA=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\In
set dirE=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\OutPut
set dirC=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\Processed
The batch file does not run and shuts down immediately and I cannot figure out what is wrong.
Couple of things you need to understand. When we set variables, we typically enclose them in double quotes in case there are whitespace, which after the whitespace, the next field is seen by cmd as a new command and you will get some errors you would not want, such as the infamous "Is not recognised as an internal command on batch file` error, so we would therefore rather do this:
set "dirA=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\In"
set "dirE=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\OutPut"
set "dirC=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\Processed"
The code then does exactly what you told it to do and that is to simply set variables %dirA% %dirE% and %dirC% with the respected values.
Now to see a result, you need to do something with those variables, perhaps we echo them?
#echo off
set "dirA=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\In"
set "dirE=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\OutPut"
set "dirC=C:\SE_BulkUnzipTarGzipFiles\WinRarSamples\Processed"
echo %dirA%
echo %dirE%
echo %dirC%
pause
Your script runs, but it finishes almost immediately.
If you add a pause command at the end, the window will stay open until you press a key.

Please can anyone tell me what am I doing wrong running this Ruby script from IRB [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I am new to Ruby and programing in general. I am trying to execute a simple ruby command from a ruby file from irb.
I have created a file sports.rb . it contains some hashes and a line of command to puts tennis as seen below.
enter image description here
But When I tried to execute the script I get the image below.
enter image description here
According to the written command, I am suppose to get "long hours" when I run the script but its not happening. Can anyone please tell me what I
1) Sports with an uppercase defines a class or module, use sports for variables.
2) you opened irb and entered a string, you didn’t try and require the file or run it. I recommend you DONT open irb and instead run ruby sports.rb from the directory

Why the backslash in bash? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I exported a variable in ~/.bashrc as follows (followed by source ~/.bashrc)
export w=/home/user/workspace/
When I'm on commandline I try to access sub-directories of $w in following way
user$ vi $w/
After this when I hit the tab key, a mysterious backslash appears
user$ vi \$w/
It disables further tab-completion. Why? May not be vi specific as it occurs even with ls.
Bash version 4.2.24(1)-release (i686-pc-linux-gnu)
Running Ubuntu 11.04
Edit
Workaround: Hit Esc+Ctrl+E before hitting tab.
Bash is a little smart, but not that smart. It's not going to be able to expand out your variable, then tab complete to whatever dir that evaluates to. So it's not the backslash "disabling" tab completion, it's the fact that bash can't find any completion suggestions to make.
Given that completion isn't going to help you if you actually do have environment variables in your path, the only way completion could help you at all is if you meant to type a literal dollar sign. I think bash is just being overzealous in trying to complete to something.
Still, I'd call it a bug, since in your case it not only fails to complete, but also changes the meaning of what you've typed.

Obtain the command line from a running process from the Command Prompt [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
The community reviewed whether to reopen this question last year and left it closed:
Original close reason(s) were not resolved
Improve this question
I wanted to determine the command-line arguments of a running process at the Command Prompt (cmd.exe).
E.g., if I started my abc.exe program as follows:
abc -d
I want to determine the whole command line later. The TASKLIST utility does not provide this info, because it just reports the exe name and not the arguments with which the process was started.
Here is a GUI-based method (Tested on Windows 7 - YMMV). I don't know of an easy method to get this data from the command-line.
Open the Task Manager (CTRL+SHIFT+ESC), and go to the Processes tab.
From the View menu -> Select Columns...
Scroll to the very bottom and select "Command Line"
In the newly-shown "Command Line" column, you can see the entire command that started the process, including any command-line parameters
Command-line method:
Start a PowerShell with administrator priviledges
Use the Get-WmiObject to list processes and filter the process name above. Add/remove fields through the select statement below - example:
Get-WmiObject win32_process -Filter "name like '%notepad.exe'"|select CreationDate,ProcessId,CommandLine|ft -AutoSize
Note: The process name "notepad.exe" is used for this example, substitute the name for your specific scenario.
the method from mellanmokb works acutally, but i think the question whould be? can i see in in code maybe, if that is the case, are you using C# o VB?.
If the case is C# you can see it in msdn library
There you can see that the arguments arrives at the Main(string[] args), and this is a string that you can read as argument = args[i] with i the number of the argument you want
for example if you call args[2] on the commandline was text.exe test here there
args[2] will be here.
remmember that args[i] is a string always.
hope this helped

Resources