batch-file

Run a batch file at folder's context menu

故事扮演 提交于 2020-01-05 02:18:05
问题 I'd like to run this batch file (setenv.cmd) when I right click on any folder: @echo off SET CPLUS_INCLUDE_PATH=C:\mingw32\include;C:\mingw32\lib\gcc\mingw32\4.9.2\include; SET PATH=%PATH%;C:\Archivos de programa\7-Zip;C:\Archivos de programa\WinRAR;C:\usr\bin;C:\msys\1.0\bin;C:\gtk2\bin SET PKG_CONFIG_PATH=C:\gtk2\lib\pkgconfig;C:\usr\lib\pkgconfig @echo on I setuped my registry from this page, with the "prompt here". My question is how to open the console window from the selected directory

At which point does `forfiles` enumerate a directory (tree)?

蓝咒 提交于 2020-01-04 23:31:35
问题 The command forfiles is intended to enumerate a directory and apply (a) certain command(s) on each item. With the /S the same can be accomplished for a full directory tree. What happens when the content of the enumerated directory (tree) is changed by the command(s) in the body of the forfiles command? Supposed we have the directory D:\data with the following content: file1.txt file2.txt file3.txt The output of forfiles /P "D:\data" /M "*.txt" /C "cmd /C echo @file" when executed in said

Batch file to delete files and folder

青春壹個敷衍的年華 提交于 2020-01-04 17:52:08
问题 I am looking for a way of deleting files that are contained in a folder with a specific name and then delete that folder afterwards. I know there there is the forfiles command line that I can use to delete the files, I just don't know how to get the folder name into the path. The folder is named based on the date that it was created and I want to delete the folder that is 7 days old. The folder is formatted as yyyymmdd. basically I need forfiles /P "C:\backups\[DATE 7 DAYS AGO IN yyyymmdd

Batch file to delete files and folder

不羁的心 提交于 2020-01-04 17:52:08
问题 I am looking for a way of deleting files that are contained in a folder with a specific name and then delete that folder afterwards. I know there there is the forfiles command line that I can use to delete the files, I just don't know how to get the folder name into the path. The folder is named based on the date that it was created and I want to delete the folder that is 7 days old. The folder is formatted as yyyymmdd. basically I need forfiles /P "C:\backups\[DATE 7 DAYS AGO IN yyyymmdd

How to get rid of enclosing double-quotes in the expanded `forfiles` variables?

坚强是说给别人听的谎言 提交于 2020-01-04 16:57:34
问题 The forfiles command establishes several variables, indicated by a leading @ , which return data concerning the currently iterated item to the loop body. All the variables related to the path and name of the iterated item return the value enclosed in "" . Those are: @file , @fname , @ext , @path and @relpath . So: how can you get rid of the enclosing double-quotes? For example, the following code returns relative paths to text files in the given root directory: forfiles /P "C:\root" /M "*.txt

Batch to process files one by one

前提是你 提交于 2020-01-04 15:31:55
问题 I have a batch file to compress PNG files. When I drag and drop some files on batch, it starts to process all of them in the same time. And it becomes useless when I tried with hundreds of files (sure) The main part is something like that (simplified) START "" /W truepng.exe /out "%~n1_out1.png" %1 START "" /W pngwolf.exe --in="%~n1_out1.png" --out="%~n1_out2.png" I think I must to solve the "%1" part. I'm trying to make batch to process files with 4-file blocks. Thinking of 2 different

R, command line, write to file fails

陌路散爱 提交于 2020-01-04 15:31:36
问题 I am trying to automate (on a Win7 system) an R script to read data from Bloomberg and write it to file, for processing by another system. My code runs in the R gui perfectly. So I wrote a batch file to call this .r file and output results to script.out as shown below. When I double click the batch file everything runs successfully. When I schedule a task to run the batch file, the R code runs, collects data from Bloomberg, but the write to file fails every time. R code library(quantmod)

Fast methods to copy(move) files in batch file

雨燕双飞 提交于 2020-01-04 14:00:12
问题 I have a massive number of files in one directory that I need to validate. The problem was, the file explorer takes too much time to load the file list and my whole computer becomes slow. So I wrote the following code to group files by moving certain number of files(shown as %limit% and will be 700) to numbered folders(shown as %DirN% ) for /f "tokens=1-2 delims=:" %%a in ('dir /b /a-d ^|findstr /n /v ".bat .cmd .txt"') do if %%a lss %limit% robocopy "%cd%" "%cd%\%DirN%" "%%b" /mov >nul This

IExpress Post Installation Batch with NodeJS not finding NPM immediately

ぐ巨炮叔叔 提交于 2020-01-04 13:40:20
问题 I'm trying to use iExpress to install dependencies on a small script that I've created on NodeJS. The iExpress package simply installs the packages Node: msiexec /i node.msi Then runs a Post installation Batch to put the Javascript into a folder in the %UserProfile% folder. The Post installation Batch is run with: cmd /c post_install.bat In the batch there is a line which isn't working: npm install <dependency> This doesn't seem to work immediately after the MSI install, but it will work the

Java Version in a batch file

守給你的承諾、 提交于 2020-01-04 13:26:32
问题 My question, is extremely similar to the following SO question: How to get Java Version from batch script? In fact, it did almost solve my problem. The only difference is that I've to check the Java version based on %JAVA_HOME%, which the user is free to modify. The issue that I'm facing is with this code: @ECHO OFF SETLOCAL enableextensions enabledelayedexpansion IF "%JAVA_HOME%"=="" ( @ECHO Please set JAVA_HOME environment variable EXIT /B ) @echo "%JAVA_HOME%" REM Checking JAVA_VERSION SET