batch-file

Copy Files /w Spaces In Name

不问归期 提交于 2021-01-28 08:38:17
问题 My code is SET usb="%CD%\Dokument\%USERNAME%\" mkdir %usb% for /R "C:\Users\%USERNAME%\" %%f in (*.docx) do copy %%f %CD%\Document\%USERNAME%\ and it works, but not for files (.docx) with spaces in their name. I've tried fixing it with quotes, and different code styles/methods, but can't solve it. (I'm new to DOS). How can I solve this? Or is there a better code to copy all the files with .docx extension from a computer to another directory/usb? 回答1: You need to quote file paths containing

How to make the console font bigger when running a batch?

自闭症网瘾萝莉.ら 提交于 2021-01-28 08:09:51
问题 I have the following batch file which I use to run my Minecraft server: (run.bat) @echo off java -Xmx1G -jar mcserver.jar I looked on many forums, and I'm too lazy to begin studying batch code, so I decided to ask here. I want to insert a passage of code that will set the font size in the console to a certain size (for example, 18px). BUT: I don't want the console to run with big font on every other batch file or cmd prompt opened... only in this file. I appreciate any answers :) I use

How to replace only the first match in a text file with jrepl using /pflag “i” switch?

我的未来我决定 提交于 2021-01-28 08:04:50
问题 I am trying to replace only the first match in a text file. My code is: FOR /R %%a IN ("*.out") DO call C:\qsi\jrepl.bat "FF**********" "**********" /f "%%a" /L /m /o - The FF before the asterisks is representing a form feed character. The code is for removing the form feed for the first match only. I was trying to play with /p & /pflag "i" , but could not get it to work. I am using the latest version 8.2 of JREPL.BAT. 回答1: It is possible to use the JREPL.BAT option /INC if the first form

How can you run a python script as a batch job after passing an argument using argparse?

允我心安 提交于 2021-01-28 07:41:47
问题 I was wondering whether it is possible to run a python script as a bash job after using argparse? I tried doing this by first passing an argument in the python script file using argparse and then I used the command: bash bash1.sh to run the bash file that will run the python script file. This resulted in an error message_script.py: error: too few arguments This error resulted from the fact that the argparse argument wasn't recognised. Is there any way I can get to pass the argument using

How do I find a directory in and store it into a variable, using a Windows batch file?

只愿长相守 提交于 2021-01-28 07:15:51
问题 I need to find the location of a specific directory, and then store that directory path into a variable within a Windows batch script. I also want the command to return when it finds a match (to avoid searching the entire hard drive once the directory has already been found). So far I've tried this on the command line: dir c:\ /s /b /ad | find "DirectoryName" The problem with this is that it searches the entire drive, even after a match is found. Plus, I still can't figure out how to store

Set and Limit file type association within the scope of a cmd shell

你。 提交于 2021-01-28 07:05:10
问题 On Windows, is there a way to create a cmd shell and set certain file type associations within it's scope and not affect system-wide file association. I'd like to launch a .bat file to open a shell with it's own defined file type association.... Something like this pseudo .bat file: [my_shell.bat] @echo off ~ASSOCIATE .jpg --> Google Image Viewer.exe ~ASSOCIATE .tga --> Adobe Photoshop ~ASSOCIATE .txt --> Komodo Edit start cmd And so, for example, any .txt file i'd open from the resulting

Batch file is not executing before application uninstalled using WiX

一笑奈何 提交于 2021-01-28 06:22:37
问题 My batch file that I'm trying to run when an Excel plugin needs to be uninstalled is not executing. I'm using the following custom actions to do post install and also on uninstalling the product. The following code: <CustomAction Id="registeraddin" ExeCommand="[INSTALLFOLDER]RegisterMilerAddIn.bat" Directory="INSTALLFOLDER" Impersonate="no" Execute="deferred" Return="asyncWait" /> <CustomAction Id="unregisteraddinpostinstall" ExeCommand="[INSTALLFOLDER]UnRegisterMilerAddIn.bat" Directory=

How do you make a batch file that merges files together?

走远了吗. 提交于 2021-01-28 06:15:39
问题 I have to merge files in a folder to a single text file and I'm not sure how to do that 回答1: Use FOR /F: http://ss64.com/nt/for_d.html For example, to concatenate all the text files in the current directory and any subdirectories, you could do: FOR /F "tokens=*" %G IN ('dir /b /s *.txt') DO TYPE %G >> out.txt 回答2: copy /b *.txt newfile.txt make sure all the text files are in the same folder along with the .bat 回答3: You can use simple redirection operator with command type suppose your

What does it mean to pipe from the Net Start command to the Find command?

☆樱花仙子☆ 提交于 2021-01-28 05:30:40
问题 An example of this is: NET START | FIND "MSSQLSERVER" > nul 回答1: I don't think this command line does make a lot of sense, but any way: NET START lists all running services, the output of this command is sent to the FIND tool, which searches for the string "MSSQLSERVER" in the input it has been given. If any line of the input matches the search condition find prints these lines an the screen, unless in a case like this, where the input is send to the null device. This is the part : > nul. 来源:

Get computer name using serial number of server remotely

我是研究僧i 提交于 2021-01-28 05:26:10
问题 Can anybody tell me how get to know the computer name using serial number remotely? Like using wmic bios get computername where serialnumber="XXXXXX" I need to know computer names of using multiple serial numbers. 回答1: You'll have to use net use to get a list of computers. Then ask each one what is it's serial number. For /f "tokens=1* delims=\ " %A in ('net view^|findstr /c:"\\"') do echo %A>> computerlist.txt wmic /node:@computerlist.txt bios get SerialNumber /format:csv|findstr /i /c: