Batch file to save all opened files and then shutdown system - batch-file

I did not find a solution online, so I will ask it here.
I would like to create a batch file that will save all openend work (for example: An opened and unsaved Word document). After it saves all opened work (with added an timestamp or a text with 'autosave'), it must shutdown.
The last part I can make myself (shutdown -t 0), but the first part is too difficult for me.
Do you have any solution?
Thank you for considering my question,
ButerBreaGrieneTsiis

Related

Btrieve file only shows partial data

Almost ready to throw up the white flag but thought I'd throw it out there. I have an OLD program from 1994 that uses a btrieve dB and renders basic membership info for a gym. The btr file that holds the data will open in notepad and I can search and find all records although the formatting is nearly unreadable. When it opens in the program there is a huge chunk of records missing. It seems to stop on specific records up and down when scrolling.
I know almost nothing about btrieve as it predates my IT career by many years and I've honestly never seen it. Any suggestions on where I should troubleshoot or tools that may help would be much appreciated.
This sounds like the file may be corrupted although I would expect errors if it was corrupted. One way to rebuild the file is to use BUTIL (and a couple of OS commands).
The steps to rebuild are:
Make a backup of the original file to another directory.
Rename the original file. I like to use change the extension to .OLD.
Delete the original file. It will be recreated in the next step.
Issue the BUTIL -CLONE command (BUTIL -CLONE
Issue the BUTIL -COPY command (BUTIL -COPY
The rebuild is complete.
I've use the commands below in the past (changing 'filename' and the extensions to match my files).
copy filename.btr someother\location\filename.btr
ren filename.btr filename.old
del filename.btr
butil -clone filename.btr filename.old
butil -copy filename.old filename.btr

How to get file name when file change is observed via watch_file

I am currently facing an issue which I don't know how to fix. I got the following Julia code:
while true
print(watch_file("test"))
end
So this should get me all the file changes in the directory named "test". At least on windows.
Now thats all well and good, and it kinda works, at least for creating a file or moving a file to that directory. This is an example of what I get:
("New Textfile.txt",Base.FileEvent(true,false,false))
But when I delete or rename that file, I don't get the filename of the file deleted or renamed.
("",Base.FileEvent(true,false,false))
Is there a different method/function I can get the filename with, even when the file is deleted or renamed? Or even better, a way that archives this and is cross-platform-compatible? Any help appreciated.
EDIT: If you could give me an alternative that supports recursive monitoring, that would be even better.
In Linux, Julia 0.4.5 and 0.4.3 watch_file returns file name always. It is a very platform-dependent feature (like in Node.js https://nodejs.org/api/fs.html#fs_caveats) and only manual polling can be truly platform-independent solution.

Batch Scripts - Alternative Output to Notepad?

Good Afternoon,
Basically, I have a batch script that does the following:
Pings multiple network machines
Writes the result to a txt file
Searches the created txt file for certain keywords, then outputs that to a separate txt file
Displays the 2nd txt file
It's all very nice and lovely, basically if the machine pings fine then all it shows is the "Pinging xxxxx [10.xxx.xxx.xxx] with 32 bytes of data:" & "Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)" lines.
If it detects anything other than a good ping, it will report the error message in addition to the 2 lines above.
Which leads me to the question...
Is there an alternative output to notepad for the log file? The information that is displays is exactly what I need, but because it's pinging 20+ assets it looks extremely cluttered and ugly. Are there any decent alternatives to display the log file?
Apologies if this is a stupidly basic question, it's after lunch so my brain is only functioning at 0.01% of it's usual power...
I made good experience with writing a .tex file and compiling it with latex (or its derivatives) into a .pdf file. Also, I use a bash script to write a .html document. An .xml file is a nice way to provide the data and an associated .xsl style sheet will add the appropriate visual representation.

"start" command in .bat batch file

I have an extremely simply batch file, which has previously worked for me but no longer will.
start /wait steamcmd +login anonymous +force_install_dir C:\Games\CSGOServer\TEST
pause
For some reason I get the following error upon running the file:
http://imgur.com/Xd8di1Y (sorry, not enough rep to enbed with html)
Any ideas why start will not work given that it is clearly an accepted command? I did notice the strange characters in front of this but cannot really tell where these would come from.
Thanks in advance.
Damon
Looks like someone saved that batch file in UTF-8 format. Open the file with Notepad and click File → Save As.... Change the field Encoding to "ANSI" and click Save. Confirm that you want to replace the file.

Watcher batch file for .txt cloning/reseting/modification

I am trying to create a batch file that works something like a watcher, here is what I am trying to do:
The batch keeps monitoring a .txt file for any modification.
Once the file has been modified by any reason, the batch file proceeds with its function.
The function can vary, either change/replace/delete a line of text inside the file or replace the actual .txt file with a previous clone of it.
After this it keeps monitoring, the cycle repeats itself to prevent the file from being modified.
I do not understand anything of batch, I have tried to find guides and ways of doing it but I am really confused so if anyone could help me with this (a guide explaining how to or the actual final batch) I would be very grateful.
Thank you for your time and patience!
Batch file article on Wikipedia will give you enough information to start understanding batch files.
There is a basic example with explanation that will be helpful getting started with running batch file.
Also take a look at the resources mentioned at the Stack Overflow Batch tag info
Once you know how to write batch files, look for commands that you will require to complete your task.

Resources