I had recently upgrade from W7 to W10 and everything seems to work but this basic batch command. Whenever I launch the file, the cmd keeps outputting "The system cannot accept the date entered"
There were no modifications to my knowledge, but perhaps there were some shifting files that happened during the upgrade, I'm not so sure.
So essentially, I need to have the batch file modify the current date since the application in question does not open correctly with the current date and reverting back to the current date a few seconds after the batch executes.
This is the batch file:
set curdate=%date%
date %date:~0,-4%2014
cd "C:\Program Files (x86)\HK-Software\IBExpert"
start ibexpert.exe
#TIMEOUT /NOBREAK /T 10
date %curdate%
The problem is that the code in that script is not compatible with the %DATE% your machine is outputting.
The following offers a quick fix as long as your machine also accepts the two digit year when setting date.
set curdate=%date%
date %date:~0,-2%14
cd "C:\Program Files (x86)\HK-Software\IBExpert"
start ibexpert.exe
TIMEOUT /NOBREAK /T 10
date %curdate%
Related
A Windows 10 application starts to lag every 10-15 minutes so every once in a while, when I notice the lag, I run the below batch file to delete the temp files. It works to eliminate the application lag but I would like to automate the batch file so that once I initiate it, it loops every 5 minutes without the cmd window poping up. Since I dont know how long I will be using the application and dont want the batch file runing after I finish using the application I need to be able to terminate the batch file manually.
Appreciate to let me know if there is options with and without the windows task scheduler.
#echo off
set targetdir=C:\ExampleDir
del /q %targetdir%\*
for /d %%x in (%targetdir%\*) do #rd /s /q ^"%%x^"
I'm running NiceHash's latest version, there's a dialog that's saved to a log.txt file. It gets large enough to crash windows, if not stopped, so I wrote a batch file with the following:
forfiles -p C:\Users\CBRocks\AppData\Roaming\nhm2\logs /m log* /c "cmd /c if #fsize gtr 50000000 del #path"
Which deletes the log file. Killing the excavator and forcing NiceHash to restart.
I'd like to write something to delete the oldest 90% of the text, but it's locked by the excavator, manually deleting and saving is a fail message. (problem1)
It looks like I'm not going to be able to do it with command shell though (problem2), so before I go off learning C++ or so, is there a way to edit [sometext] to [""] in a file with an open lock file?
this is a recurring string:
"time":"2018-01-23T03:00:30.238Z"
I think I can use it to delete text where the timestamp is more than 00:30:00 earlier than that, I would like to call a batch file to do the text editing/file saving instead of deleting the file. I'm going to have to load an editor though, or point the command shell at some text functions that already exist for Windows 10 64-bit.
Do-able?
Suggestions for an easy-to-use batchfile editor?
I have a BAT File which connects to an FTP site to send/receive files. On rare occasions the batch file will hang if there is an issue with the network. I would like to know if there is a command to automatically exit the batch file if it has been running longer than 5 minutes? This would be placed in the batch file I assume, a kind of countdown from when it first opens.
Thanks.
Brett
You have to have two windows.
start ftp etc
Timeout /t 300
taskkill /im ftp.exe /f
This will kill all ftp.exe not just one. NOTE this relys on the fact we are running ftp without running cmd in the second console window.
I am uploading a running a simple batch script which downloads a file from one server and uploads it to another. The file name is based on the previous day ie. 20111124.zip (YYYYMMDD). The script works fine on all the boxes I have tried it on, however when it is run on a colleagues windows 7 box it fails. The DATE command returns a zero. I have already tried setting the UAC to off but that did not resolve the issue. Any help would be greatly appreciated.
SETLOCAL
SET dwMONTH=%DATE:~4,2%
SET /A dwDAY=%DATE:~7,2%-1
IF %dwDAY% LSS 10 (SET dwDay=0%dwDay%)
SET dwYEAR=%DATE:~10,4%
SET dwDate=%dwYEAR%-%dwMONTH%-%dwDAY%
SET mydate=%dwYEAR%%dwMONTH%%dwDAY%
echo %mydate%
Windows 7 doesnt include a day name,
e.g. on windows XP %date% contains "Di 25.10.2011" (im on a german computer system)
and Win7 only "25.10.2011",
so your offset (7) is pointing to the wrong spot
I've seen a related question on this website regarding a Linux system. I have the same question on a Windows XP OS. I bought a Winchester USB external HD, and found out from technical support that the sleep feature is in the firmware and cannot be turned off. I'm looking for an application that will automatically read/write to that drive periodically to keep that timer resetting (every 5 minutes?). Is anyone aware of a small application for Windows XP that will do that?
Thanks for your help.
I have tried nearly everything to fix this problem on my external which is shared out containing my movies. Nothing ever worked. I have a WD Mybook, and I think the sleep is occurring internally in the drive.
I have a solution that works for me, and should for anyone else. The key is to keep the USB drive doing something. Not a lot, but something simple, causes some type of change on the drive.
Windows XP does not have a SLEEP command, but you can download one and add it to the SYSTEM32 folder. Then all you need to do is make a simple batch file, and put it in your startup folder so it executes when you log in.
Make sure you have write access to the drive. Change the drive letter to yours...
Make a batch file.
:start
#echo off
#cls
#echo Keeping USB Drive Awake. Do not close this window!
#sleep 60
#dir E: /S /B >E:\keepawake.txt
#echo Drive Accessed %date% at %time% >keepawake.txt
goto start
This will write the full directory structure to a file on the E: drive in a file called keepawake.txt. Then it will overwrite it with a simple note containing the date and time. This will always be different. It will do it every 60 seconds.
Problem solved...
-Krehator
Make batch (.BAT) file something like this:
#echo off
:start
copy c:\windows\notepad.exe g:\ (Or whatever your external drive is)
choice /N /D Y /T 120 (The 120 is the delay in seconds)
goto :start
You could try NoSleepHD.
http://nosleephd.codeplex.com/
It writes an empty text file to your chosen drive every few minutes (you can choose the minutes) to stop the drive going to auto-sleep mode.
google: nosleephd
Ashx
I'm using the free/open source Windows program KeepAliveHD (http://keepalivehd.codeplex.com/) to accomplish this. Works well.
Any text editor with an autosave function would do it.
You could also write a batch file to get a directory listing, and have it act recursively (call itself) after a set time period. Or use windows scheduler to execute it.
use this batch file
change the 1st two lines letter t: to your drive letter.
it works in all versions of windows
#echo off
:start
REM --- Change the drive letter below to match your HDDs. To add another drive replicate the copy and del lines ---
copy NUL t:\HDDActive.txt
del t:\HDDActive.txt
TIMEOUT /T 30 /NOBREAK
goto start