cmd

Batch variable inside a variable not working when called

两盒软妹~` 提交于 2020-01-16 01:17:38
问题 Inside Test.txt reads a URL on the first line, theres more but for this it unimportant. setlocal EnableDelayedExpansion set browser=chrome.exe set i=0 for %%f in (Test.txt) do ( set i=0 for /F "delims=" %%l in (%%f) do ( set /A i+=1 set line!i!=%%l )) ::the above read the contents of Test.txt and saved each line to a different Variable made up of two variables set x=0 :ReadLines if %x% gtr %i% ( goto Completed) set /a x+=1 set /a odd=%x%%%2 if %odd%==1 ( set Address=!line%x%! echo !Line%x%! :

Running a .exe file inside java code

£可爱£侵袭症+ 提交于 2020-01-16 01:14:05
问题 I am trying to run a .exe file that I have generated inside a Java code. I have a GUI written in Java and the .exe file is generated using MATLAB (its actually a Simulink model). When I run the .exe file separately (i.e. I double click on it) it will create an output file ( which is what I expect) but when I run my Java code it opens the command prompt but it won't generate any outputs at all -in fact I am not even sure if it runs my .exe file or not. Here is my code: package combustionModel;

Batch SetLocal EnableDelayedExpansion and Math problems

…衆ロ難τιáo~ 提交于 2020-01-16 00:54:08
问题 C:\WINDOWS\system32>SetLocal EnableDelayedExpansion C:\WINDOWS\system32>set/a Number1=3+9 12 C:\WINDOWS\system32>if !Number1!==9+3 (echo Good) else (echo Bad) Bad C:\WINDOWS\system32>if !Number1!==3+9 (echo Good) else (echo Bad) Bad C:\WINDOWS\system32>set/a i=9+3 12 C:\WINDOWS\system32>if !Number1!==%i% (echo Good) else (echo Bad) Bad I expected to see the last results (and maybe some others) to show Good as a result but did not! I think this is because it is a error with the SetLocal

How do I read individual PowerCfg settings?

耗尽温柔 提交于 2020-01-15 12:15:07
问题 If I run this command: powercfg -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c ...I can subsequently run this command: powercfg -GETACTIVESCHEME ...and it will tell me what I did. (It will output 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c.) Similarly, if I run this command: powercfg -change -monitor-timeout-dc 0 I want to know how I can query that. Is there some powercfg flag where I can read the current value of monitor-timeout-dc , and other settings like that? 回答1: This returns the monitor

Get Previous and day before Previous date in batch file(cmd)

China☆狼群 提交于 2020-01-15 11:34:17
问题 I have the following to determine the date and grab a file based on date. I need to modify this grab a file that has a date of yesterday and day before yesterday, i.e. date-1 and date-2. What do I need to change? Thanks! echo @echo off > uploadsp.txt set mydate=%date:~10,4%%date:~4,2%%date:~7,2% echo set mydate=%date:~10,4%%date:~4,2%%date:~7,2% >> uploadsp.txt set myfile=Epic_DSH360144_Drug_Utilization_%mydate%_DU.txt echo put %myfile% >> uploadsp.txt exit 回答1: You can also call out to

Move Wildcard Folder structure files to a destination folder

妖精的绣舞 提交于 2020-01-15 10:41:27
问题 I want to move all the folders starting with "Temp_*****" to a different folder. It does not seem like we can use wild card with Folders. I was looking online, and someone posted this piece of code but I'm not sure how to apply it to my scenario. @echo off for /d %%a in ({*}) do xcopy "%%a" "C:\Home\a\b\tmp\%%a\" /E 回答1: Here's one way to do it, replace C:\TEST01\ with your source folder location: for /F %%a in ('dir C:\TEST01\TEMP_* /ad /b') do move C:\TEST01\%%a C:\Home\a\b\tmp\%%a 来源:

Batch file to copy file from specific sub folder inside a folder to destination folder

我的梦境 提交于 2020-01-15 10:15:19
问题 I have a folder structure like his folder1-------| |123456------123.txt abc.txt |234567------fgt.txt 234.txt |abc---------ytr.txt 1234.txt I need to copy files from Main folders sub directories if the sub folder has a length of 6(only numbers) . So .txt files from 123456,234567 will be copied and abc will not be copied. I have tried using wildcards but not succeed yet. Thanks in advance. >xcopy /s "C:\Users\xxx.xxx\Desktop\folder1\*\*.txt" "C:\Users\xxx.xxx\Documents\New folder" /l /D:09-09

Python hangs while executing pip and virtualenv and brings no results

故事扮演 提交于 2020-01-15 09:17:46
问题 I tried to set up a virtual environment for my project by executing virtualenv myenv . The folder seemed to be generated, but the command hung, and I couldn't execute another command. I had to close the console and restart cmd. The folder was generated, as I said, but I couldn't activate the virtual environment by venv\Scripts\activate . I met the same behaviour while trying to execute pip freeze > requirements.txt . The file was generated, but it was empty, although I used a lot of packages

Python hangs while executing pip and virtualenv and brings no results

依然范特西╮ 提交于 2020-01-15 09:17:33
问题 I tried to set up a virtual environment for my project by executing virtualenv myenv . The folder seemed to be generated, but the command hung, and I couldn't execute another command. I had to close the console and restart cmd. The folder was generated, as I said, but I couldn't activate the virtual environment by venv\Scripts\activate . I met the same behaviour while trying to execute pip freeze > requirements.txt . The file was generated, but it was empty, although I used a lot of packages

Schedule `at` jobs with cygwin

青春壹個敷衍的年華 提交于 2020-01-15 08:45:12
问题 I am running a bunch of simulations on several (non-equivalent) client machines. In order to ensure that each simulation is run only once, the clients connect to and schedule a task on a linux server. The linux server runs the scheduled task, which ssh 's back into the client and schedules a run of the next simulation to be run. Since some of the clients run windows XP (running cygwin), part of the scheduling script on the client side checks if the client is running linux or cygwin and