command-prompt

Unrecognized PORT command

浪子不回头ぞ 提交于 2020-05-11 06:58:07
问题 In my localhost, running below command PORT=4080 node server.js But, it was throwing an unexpected error. 'PORT' is not recognized as an internal or external command, operable program or batch file. Do I need to install any module or did I miss any syntax to run it properly? 回答1: Apart from cross-env, Below command can serve the purpose. SET PORT=4080 && node server.js PS: Set environment variable for nodeJs, run command in project folder. 回答2: Install this additional package cross-env in

How can I change the PowerShell prompt to show just the parent directory and current directory?

核能气质少年 提交于 2020-04-29 10:02:18
问题 I would like to shorten my PowerShell prompt so that it just shows the parent directory and the current directory. For example, if the pwd is C:\Users\ndunn\OneDrive\Documents\Webucator\ClassFiles\python-basics\Demos I want the prompt to be: PS ..\python-basics\Demos> I can get it to be just PS ..\Demos> by changing the prompt() function in the Profile file: Find location of Profile file by running $profile in PowerShell. Open (or create and open) Profile file. Change (or add) the following

Get current directory from the command prompt when calling a Java application

寵の児 提交于 2020-04-16 08:30:38
问题 I have a Java application which I call from the command prompt like this: C:\Mydir> C:\dir2\my.exe When I call this application I would like to retrieve at the same time the path "C:\MyDir", i.e. the active directory from where my exe is called in the prompt and not "C:\dir2\" where the exe is found. How could I do that in Java? 回答1: I believe you would use String currentLocation = System.getProperty("user.dir"); 回答2: File f = new File(""); System.out.println(f.getAbsolutePath()); 来源: https:/

Get current directory from the command prompt when calling a Java application

故事扮演 提交于 2020-04-16 08:30:09
问题 I have a Java application which I call from the command prompt like this: C:\Mydir> C:\dir2\my.exe When I call this application I would like to retrieve at the same time the path "C:\MyDir", i.e. the active directory from where my exe is called in the prompt and not "C:\dir2\" where the exe is found. How could I do that in Java? 回答1: I believe you would use String currentLocation = System.getProperty("user.dir"); 回答2: File f = new File(""); System.out.println(f.getAbsolutePath()); 来源: https:/

How to run multiple commands in a batch file?

牧云@^-^@ 提交于 2020-03-18 11:50:51
问题 I am having the below commands in a batch file. While i try to run it using Execute action in Finalbuilder project, 1st command alone was run. So, i planned to have each commands in various batch files. Could anyone please help me to run all the commands in a single batch file run with the delay (if required)? Commands: dnvm list dnvm install 1.0.0-beta8 dnvm use 1.0.0-beta8 –p dnvm -Args alias default 1.0.0-beta8 Also i am getting the below error when run the last command through batch file

Output in Reverse in CMD

亡梦爱人 提交于 2020-03-04 16:38:27
问题 I have a phrase that needs to be outputted in results.txt. The phrase comes from x.txt. For example: "I have two kids", it should output "kids two have I" in results.txt. UPDATE Its already working but i want no loop. Pls see code below Code @ECHO OFF set /p content=<x.txt SET var=!content: =,! SET rev= :LOOP IF NOT "!var!"=="" ( FOR /F "delims=, tokens=1,*" %%F IN ("!var!") DO ( SET rev=%%F,!rev! SET var=%%G ) ) ELSE ( SET rev=!rev:~0,-1! GOTO ENDLOOP ) GOTO LOOP :ENDLOOP ECHO !rev:,= ! >

Get pretty git rev name

不问归期 提交于 2020-02-24 17:09:00
问题 So I know this question have been asked a lot , but I don't find any suitable answers. I'm looking to display the name of the current git rev in my prompt, but in a pretty way : if I'm on a branch, I want the name of the branch; if it's not a branch, I'd like the relative name (ie master~2 ) in my prompt. At first, I was using something like what you can see here. It worked well : I had the name of the branch, or the rev SHA1 number. Then I moved to an approached based on git name-rev , which

Get pretty git rev name

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-24 17:04:36
问题 So I know this question have been asked a lot , but I don't find any suitable answers. I'm looking to display the name of the current git rev in my prompt, but in a pretty way : if I'm on a branch, I want the name of the branch; if it's not a branch, I'd like the relative name (ie master~2 ) in my prompt. At first, I was using something like what you can see here. It worked well : I had the name of the branch, or the rev SHA1 number. Then I moved to an approached based on git name-rev , which

Find Windows PID of a python script with Windows Command Prompt

ぃ、小莉子 提交于 2020-02-06 03:51:27
问题 I am running two different python scripts running on a windows machine simultaneously and would like to kill one but not the other from the command prompt. Using taskkill with the name "python.exe" does not allow me to choose to kill just one of these scripts. Is there a way in windows to kill just one of these tasks, determined by the script from which it originated? For example: if I run python_process1.py and python_process2.py and would like to kill the .exe associated with just python

Find Windows PID of a python script with Windows Command Prompt

好久不见. 提交于 2020-02-06 03:51:06
问题 I am running two different python scripts running on a windows machine simultaneously and would like to kill one but not the other from the command prompt. Using taskkill with the name "python.exe" does not allow me to choose to kill just one of these scripts. Is there a way in windows to kill just one of these tasks, determined by the script from which it originated? For example: if I run python_process1.py and python_process2.py and would like to kill the .exe associated with just python