cmd

How to display cmd prompt after printing output to cmd.exe?

夙愿已清 提交于 2020-05-27 13:23:10
问题 I have an winmain application that is executed from cmd.exe and prints output to it. I atach to the cmd.exe using AttachConsole(ATTACH_PARENT_PROCESS) . After application is executed and output is printed to cmd.exe command line prompt is not displayed and it looks like application is stil running(while it is already closed). Before closing my application I release the console using FreeConsole() . #include <iostream> #include <fstream> #include <windows.h> int wWinMain ( HINSTANCE hInstance,

How to display cmd prompt after printing output to cmd.exe?

馋奶兔 提交于 2020-05-27 13:21:09
问题 I have an winmain application that is executed from cmd.exe and prints output to it. I atach to the cmd.exe using AttachConsole(ATTACH_PARENT_PROCESS) . After application is executed and output is printed to cmd.exe command line prompt is not displayed and it looks like application is stil running(while it is already closed). Before closing my application I release the console using FreeConsole() . #include <iostream> #include <fstream> #include <windows.h> int wWinMain ( HINSTANCE hInstance,

Robocopy become a endless loop

半世苍凉 提交于 2020-05-27 05:19:09
问题 I have a robocopy batch file in C:\batch. Here is the batch file: set LOG="C:\Log\robolog.txt" set START1="C:\WORK" set END1="\\fs-02\Work" Robocopy %START1% %END1% /MIR /PURGE /SEC /SECFIX /R:1 /W:5 /V /ETA /LOG:%LOG% My question is if i open cmd from the location (c:\batch) that contains this batch file and run it from there, it just runs it over and over again and never ends....and i can not even terminate the cmd .... Ctrl+C will only speed up the loop..... but if cmd start location is

Running JavaScript from the windows command prompt

痴心易碎 提交于 2020-05-26 19:21:51
问题 I wrote the following JavaScipt code which converts a binary number into a decimal number: (function bin_dec(num) { var x = num; var result = 0; for (var i = 0; i < x.length; i++) { result += eval(x[x.length - i] * 2^i); } return result; })() I want to be able to run this code from the command-line. The filename is converter.js and I am running the command prompt window in the same directory as the file. I am trying to run this code using 01001100 as the function argument. Here are my

Running JavaScript from the windows command prompt

做~自己de王妃 提交于 2020-05-26 19:17:00
问题 I wrote the following JavaScipt code which converts a binary number into a decimal number: (function bin_dec(num) { var x = num; var result = 0; for (var i = 0; i < x.length; i++) { result += eval(x[x.length - i] * 2^i); } return result; })() I want to be able to run this code from the command-line. The filename is converter.js and I am running the command prompt window in the same directory as the file. I am trying to run this code using 01001100 as the function argument. Here are my

CMD.exe: Get second column output to variable

…衆ロ難τιáo~ 提交于 2020-05-25 08:10:06
问题 I need the below command second column output <USERNAME> result to variables: query sessions|find "Active" >console <USERNAME> 1 Active I know the %USERNAME% OR whoami could get the current user name but this script will run using administrator account and will need to be able to capture the current active logon username. If I could select the second column of the output results and assign it to a variable.. this will be a great help. 回答1: In this case you should use FOR /F to capture the

CMD.exe: Get second column output to variable

孤街浪徒 提交于 2020-05-25 08:09:52
问题 I need the below command second column output <USERNAME> result to variables: query sessions|find "Active" >console <USERNAME> 1 Active I know the %USERNAME% OR whoami could get the current user name but this script will run using administrator account and will need to be able to capture the current active logon username. If I could select the second column of the output results and assign it to a variable.. this will be a great help. 回答1: In this case you should use FOR /F to capture the

How to get Windows CMD ECHO to echo exactly one single character?

你说的曾经没有我的故事 提交于 2020-05-25 07:10:07
问题 The (unofficial) documentation for the Windows Internal CMD ECHO shows some interesting tricks in it. However, I have not yet found a way to echo a single character . Quick note, od used below, is from a Git (or Gow) installation For instance, this echo's the 'a' with a 'windows' newline ( \r\n ): >echo a| od -A x -t x1z -v - 000000 61 0d 0a >a..< 000003 And this trick (also in the docs now) echo's nothing: ><nul (set/p _any_variable=)| od -A x -t x1z -v - 000000 So I would expect this to

Different Java version showing on command line

六眼飞鱼酱① 提交于 2020-05-25 03:40:46
问题 I have recently checked on my Java version. I ran the command java -version and I found out that I was using java version 1.7.0_09 . But when I tried to check on C:\Program Files\Java\ directory, I don't seem to find the same version. I only see the following: j2re1.4 jdk1.6.0_32 jdk1.7.0_06 jdk1.7.0_07 jre6 jre7 And so on... My programs still run, but I'm just trying to compile everything manually, and understand how Java is being treated by the OS. Another thing that is weird is, I tried to

Different Java version showing on command line

时间秒杀一切 提交于 2020-05-25 03:38:47
问题 I have recently checked on my Java version. I ran the command java -version and I found out that I was using java version 1.7.0_09 . But when I tried to check on C:\Program Files\Java\ directory, I don't seem to find the same version. I only see the following: j2re1.4 jdk1.6.0_32 jdk1.7.0_06 jdk1.7.0_07 jre6 jre7 And so on... My programs still run, but I'm just trying to compile everything manually, and understand how Java is being treated by the OS. Another thing that is weird is, I tried to