I would like to create some batch scripts to move some files around. But i was wondering if there are any good resources on how to do this? Do you just use Command Line arguments?
At its simplest level, a batch script is a text file with a .bat extension, and consists of the same commands you would enter at the command line, separated by carriage returns.
Thus, the file:
md C:\HelloWorld
Is a batch script that attempts to create the directory "HelloWorld" on your C: root.
Batch scripts can be much more complex, involving variables and flow control logic, but before you travel that road, you may want to investigate powershell and WSH.
Edit Oops... fixed the link to powershell.
Basically, you just do command-line argument. But there are certain types of variables supported, and also command-line arguments to the batch file, which you can use.
http://www.computerhope.com/batch.htm
Related
Is there some way to pass parameters (or command line arguments) to a Yosys script?
I see in this quetion (Can we have variables in a Yosys script?) you can run the Yosys script within a TCL interpreter. Is there some way to pass in an argument?
The reason I am doing this is that I have a script, and I want to be able to call the script with a parameterized path to a Verilog file. Surely this is a common need, and there must be some easy way to do this, but I'm not seeing it.
The only way to do that at the moment is using environment variables and TCL scripts. For example, you can write a TCL script test.tcl:
yosys read_verilog $::env(VLOG_FILE_NAME)
yosys synth -top $::env(TOP_MODULE)
yosys write_verilog output.v
And then call if with VLOG_FILE_NAME and TOP_MODULE set in the environment:
VLOG_FILE_NAME=tests/simple/fiedler-cooley.v TOP_MODULE=up3down5 yosys test.tcl
If you are running Yosys from a shell script you can also simply run something like export VLOG_FILE_NAME=... at the top of your script. Similarly you can use the export Makefile statement when you are running Yosys from a Makefile.
I was facing a similar case. This question showed up while I was working on a solution. I ended up with a different approach though:
I'm creating a wrapper to my top module, written in m4 language. It's very simple, it overrides the parameters value, and then includes my top module definition.
Then in the Makefile, I process the wrapper.m4 file, to create the resulting wrapper.v file, that will be input to yosys.
I have detailled the solution here.
Difference between batch files and BCP Commands???
As per my knowledge BCP(Bulk copy program) is used to load the data from flat files to database in a fast way and vice versa and batch files are used to copy the files from one location to other location, to create new directories..etc using MS-Dos commands.
Can i get exact difference between Batch files and BCP Commands??
Thanks
Venaikat
Batch files are to BCP as Java is to JavaScript
BCP is a command line tool
Batch files allow you to script command line tools, to make them perform their various functions in a repetitive and reproducible way, without needing keyboard or mouse interaction.
Batch files are a general purpose programming scripting language that is interpreted, and so is slower than a compiled language, but batch scripts are generally much faster to develop a program/script to perform a task. They also have limitations when compared to many compiled languages, with poison characters etc.
Hi there. I am busy with making kind of script in batch.
I need to insert into it kind of "Resume" function.
I know how to write variables into a file.
But is it possbile to get it back?
Is it possible to get variables from registry?
I found a nice BAT => EXE converter. It looks really professional if you run .exe in place of .bat. I would like the user to download .exe installer of my batch program, and install the real program. But is it possible to install it (place file of program) as .exe? I don't know much about .exe languages.
If I understand your questions correctly,
Do you want to read a variable that was previously written to a file back into the batch script? Yes, it is possible to read a file into a variable as long as you know the file's format.
Yes, it is possible to read keys and values from the registry using the reg command.
Once you convert a .bat script into an .exe you can distribute it however you like. Place it in a .exe installer, zip it in a archive.
I have 2 MULTILINE text files, I want to combine them into a third file in an Msbuild script.
Ideally, I would have a token in one file, say %REPLACEME%, somewhere in the middle of that file, and I would want it replaced with the contents of the 2nd file (which contain multiple lines of text).
I want to do this in MSBUILD, although a Windows Shell solution would suffice, and so would the usage of some 3rd party utility (preferably small, and a single exe).
The solution is trivial if the content of the replacement text file is just one line .. but that is not the case.
Note that I want to AVOID using Powershell, I also want to avoid building my own MsBuild Tasks.
Thanks
You can use the MsBuild Community Tasks which have a RegexReplace task. I use it for my builds without any problem
I have a DCL script on VMS which calls a perl script. Is there a VMS/DCL command I can use that will tell me every file handle opened by the perl script?
Set default to the disk the app runs from (or you might have to try each disk in succession if it's a really large or distributed app). Then the command is
show device/files/nosystem
If you're on a more recent version of VMS and the lists are too long, you can pipe it with a search by doing this:
pipe show device/files/nosystem | search sys$input (name of perl script)
You need to find the documentation for undocumented VMS features :-)
Seriously I think that set watch might do what you want. If you issue
$ set watch file/class=(all,nodump)
$ perl yourperlscript.pl
You will get loads of output that will hopefully include what you want. I havent done it for years, you probably tune the options to fine tune it. See
http://www.parsec.com/openvms/undocumented.php?page=13
Jason, I need more clarification for a). Are you saying that you want to run your perl script in a batch file and have the batch file monitor the files being accessed by the perl script? Or something else?
Hmm, not sure about that. Maybe add a linux tag to your post so that some linux people can see this and chime in. I'm not sure why your perl program wouldn't know what files it opened. It's your program, wouldn't it access the files you told it to access? Or if you're computing the filenames somehow (which I've done in cobol, but still know at least which directory to find them in, and what naming scheme they use), you'd still have clues like what I mention. Also, since it's your program, and if you're computing the filenames, coudn't you also make your Perl program output it's own little report of what the files were? Like, just after it computes the filename, have it copy the name string to a separate report file.