简体   繁体   中英

How can a text file be edited from a Windows batch file?

I am trying to make a .bat file to edit the redirect in index.asp to be the filename of the file selected via the context menu option .bat file.

I know how to replace the file:

@echo OFF
del/q D:\e-lib\index.asp
copy %1 D:\e-lib\index.asp

but not how to edit the contents so that the redirect within index.asp points to the filename of the file I right-click, ie the value %1.

I'm not sure about editing a file via DOS BATCH file, but you could easily pump in the contents of the file using the print command (eg "something" > file.asp). You could also build a template that reads in a text file via ASP, that has the contents of the data you need to include in your dynamic ASP file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM