dos

How can I suppress filename extensions at the command line interpreter and batch files?

回眸只為那壹抹淺笑 提交于 2019-12-24 15:06:12
问题 Example: I have a file: FILENAME.EXT and would like to extract FILENAME without the .EXT I want to be able to use the extensionless filename for a command which only accepts filenames without its extensions. I have a utility called BCHECK which accepts as its argument a filename with no extensions. Using BCHECK *. does not work because all the files have .DAT or .IDX extensions. These files are constantly being renamed, thus I need to provide BCHECK with the new filenames without having to

How do I use DOS interrupt 21h/AH=25h (set interrupt vector)?

回眸只為那壹抹淺笑 提交于 2019-12-24 14:43:18
问题 I prompt the user for input: mov ah, 0Ah mov dx, OFFSET buffer int 21h My assignment tells me that ctrl-c should "abort the program with an appropriate error message". I was told that int 23h is called whenever ctrl-c is called or detected. Apparently I can register my own interrupt handler via int 21h / ah=25h. But I don't know how to make an interrupt handler, nor do I know where this is supposed to go in my code. Assistance would be appreciated, thank you in advance. 回答1: As far as I know

Problem with the start /wait command

◇◆丶佛笑我妖孽 提交于 2019-12-24 10:47:49
问题 @echo off start /wait notepad start worpad This is the code i have written in a batch file. My aim is to stop the batch file execution till the notepad application gets closed. Its working perfect but the thing is, Its displaying the command prompt also .Its opening the command prompt when i execute start /wait notepad in my batch file. The command prompt gets closed when i close my notepad. But i dont want the command prompt.How do i make that. I even tried these cmd /c start /wait notepad

Move files to folders with partial names

霸气de小男生 提交于 2019-12-24 10:04:45
问题 I have about 250 files that I need to move to a specific folder. The problem is that folder only have the partial name of the files. For example, I need to move file "12345.txt" to folder "12345 - hello" as each folder starts by the actual file name. Can I do this in a batch file in DOS? Thank you. 回答1: Assuming Windows, it's actually not hard: @echo off rem loop over all files for %%f in (*) do call :process "%%f" rem this is necessary to avoid running the subroutine below rem after the loop

Changing datetime format in csv files

久未见 提交于 2019-12-24 08:35:31
问题 I've got multiple csv files with this structure: text, text, 01/27/2001 01:00:00 PM I need to update ALL csv files with this datetime format: text, text, 27-Jan-2001 13:00:00 Is there a way of doing this via Batch file/ another automated way? Thanks, 回答1: This can be done well within batch file, with the help of a single line powershell command. Powershell is inbuilt in all newer OS's (after Win7, Win2008) and can be installed on legacy OS as well. below is the code and sample output - @echo

how do I get a for loop to work on a single line comma delimited string with spaces

爷,独闯天下 提交于 2019-12-24 08:26:16
问题 I've got an input to a batch file that contains a list of files (this is all one line and one of many inputs to the bat file): "\\Server\my directory name\subdir,\\Server\my directory name\subdir2,\\Server\my directory name\subdir3" I'd like to iterate this list and perform a command on each directory in the list. However, when I specify delims=, it treats the spaces as delimiters, even though the docs say "Specifies a delimiter set. This replaces the default delimiter set of space and tab."

for loop in batch file [duplicate]

六月ゝ 毕业季﹏ 提交于 2019-12-24 08:25:22
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Random variable not changing in “for” loop in windows batch file I have text file with list of files I want to rename. This is my code: for /f %%i in (tmp.txt) do set script_name=%%i & ren %script_name% %script_name:~0,9%%num%%script_name:~15,9%.sql But in second part it takes %script_name% only in the first iteration of the loop. So ren %script_name% %script_name:~0,9%%num%%script_name:~15,9%.sql always do the

Batch create folders based on series of files and move to subdirectory

血红的双手。 提交于 2019-12-24 08:19:18
问题 I have this batch script I found online that takes a file name and makes a folder based on the name of the file and then moves the file into that folder: for %%f in (*) do @(md "%%~nf"&move "%%f" "%%~nf")>nul 2>&1&1 I want to take similar files and move them into same folders, all multiple files have 001 002 003... ect at the end, so I just want to sort and move them based on everything besides the numbers on the end. I've did some digging and I think I need to use %%var:~start,end%% in that

command line to create data source with sql authentication?

时间秒杀一切 提交于 2019-12-24 08:11:38
问题 I'm looking to run a batch file on windows xp professional which creates a system odbc data source for a sql server connection. I can do that with: ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=Kappa| Description=Kappa Data Source | SERVER=10.100.1.10 | Trusted_Connection=Yes | Database=subscribers" However I need a way to set the sql server authentication to be "With SQL Server authentication using a login ID and password entered by the user." to be set and preset the login id and pass. Any

How to run multiple commands from ant exec task

青春壹個敷衍的年華 提交于 2019-12-24 05:44:44
问题 I want to run two dos commands from Ant exec task. I have tried below code <exec dir="${testworkspace}\${moduleName}" executable="cmd" failonerror="true" output="${testworkspace}\${moduleName}\BuildConsole_TC${tc_num}.log" resultproperty="execrc"> <arg value="/c echo Download Status is ${DownloadStatus}"/> <arg value="/c Load.bat ${moduleName} ${Intapp} ${CcvStatus}"/> </exec> but it executes only first command and skips second. I am trying this on windows OS. 回答1: This should work. Simply