Content Type
Profiles
Forums
Events
Everything posted by Yzöwl
-
You could improve on that too because there's no need to create a command which gives you something you already know, i.e. the files name. @ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION IF %1' EQU ' GOTO :EOF SET "P_=%~1" & SET "D_=" FOR /F "USEBACKQ" %%# IN (`WMIC DATAFILE WHERE "NAME='%P_:\=\\%'" GET^ CREATIONDATE^|FIND "+"`) DO SET D_=%%~# ECHO=%D_:~6,2%/%D_:~4,2%/%D_:~,4% %~nx1 PAUSEYou could obviously replace %~nx1 with %~f1 or %P_% if you prefer
-
First of all you are asking your script to do too much work! Instead of creating a command to list each file and performing another command on each file, you can work directly on the input directory. Once you've reduced the work you simply need to change the way you format your WMIC syntax, (remember too that the comma needs escaping) Try this: @ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION IF %1' EQU ' GOTO :EOF SET "P_=%~1" SET "P_=\%P_:*\=%\" FOR /F "USEBACKQ TOKENS=1*" %%# IN (`WMIC DATAFILE WHERE^ "DRIVE='%~d1' AND PATH='%P_:\=\\%'" GET CREATIONDATE^, NAME^|FIND /I "%~d1"` ) DO CALL :_O "%%#" "%%$" PAUSE & GOTO :EOF :_O SET "D_=%~1" ECHO=%D_:~6,2%/%D_:~4,2%/%D_:~,4% %~2
-
Of course I could, but I'd have probably tried to look for a different method of identifying the lines required/not required. Perhaps: @ECHO OFF >ListOfFiles.txt TYPE NUL FOR /F "TOKENS=1,3*" %%a IN ( 'DIR/TC/A-D C:\Users\myusername\mydirectory^|FINDSTR/BVC:" "') DO ( >>ListOfFiles.txt ECHO=%%~a %%~c)
-
No you either run them directly in a Powershell Window (as opposed to a CMD Window). You can find Windows Powershell quickly by entering POW in the search files dialog on your Start Menu. An alternative is to write it as you would a BAT / CMD file but give it the extension PS1, I did, it murdered your first attempt using FORFILES and answered the question asked at the time of posting! Your second attempt made assumptions and is therefore discounted as a proper solution.
-
Well if you're using Windows 7 then it would be foolish to not mention Powershell Here's an example line which should give you a listing also ordered according to that Creation Date and Time. GCi C:\Users\myusername\mydirectory | Select-Object Name, CreationTime | Sort CreationTime | Out-File ListOfFiles.txt
-
I would suggest that yuor problem lies in having all of the windows with the same title. You would probably be able to give them a new title with CMDOW's /REN switch possibly using the %port_add% variable in the name to make each one unique. As a result you'd have different names to identify each one with for making them visible again. Before you go down that road you may be better off looking at a slightly different but similar tool, TrayIt!. It appears that you may be able to group these windows together/hide them in a different way.
-
Which console(s)? Your end user is defining a number of redirects, if they choose 30 then you are effectively running the command above 30 times in a loop with a user defined delay of anything from 0 to 9 seconds between each separate run command. Are these the consoles which are still showing when run with cmdow?
-
[Batch] Ping Script ?
Yzöwl replied to CaTaLinU's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Is there a particular reason why you are looking for the average round trip time from four pings with a one second timeout? BTW I'd probably change the above example to this @ECHO OFF & SETLOCAL ENABLEEXTENSIONS (SET addr=95.76.53.219) FOR /F "TOKENS=4 DELIMS==" %%# IN ('PING %addr%^|FIND "Average"') DO ( ECHO=Your connection to %addr% is%%#) PAUSE -
It could be converted to HTA, AutoIt or VBS because it is basically a series of commands based on interactive responses to choices. The majority of the file is unnecessary code used to beautify the command window. The problem I think is unrelated to the batch file, I now think that what CaTaLinU is actually asking for is to be able to run HLDS.exe in console mode without that console appearing!They may also find that running START with the /B switch would prevent an additional window from opening.
-
Create .bat file to run after windows install
Yzöwl replied to ewilliams's topic in Unattended Windows 7/Server 2008R2
I'm not interested in your reasoning behind installing rubbish software onto other peoples machines, suffice it to say that I will never agree to it. (most of my PC work has been based around removing unwanted pre-installed software and viruses from OEM's ill chosen anti-malware solutions).That however is only a minor irritation, there are two main issues here: The OP has provided no information whatsoever on which method they are using for installing Windows XP or for installing Windows 7 onto these machines for 50 year olds. (both completely different and only one of which is covered in this particular forum area) The batch file they are requesting help with indicates a poorly thought out system. Why go to the lengths of creating a single media which deploys both 64-bit and 32-bit. This means relying on the batch to make the software installation determination for you and having to manually rename a bunch of files so that each can be identified by the batch according to the bitness. (when you create installation media, there is no real benefit in integrating both 32-bit and 64-bit on that same media. It is extra work just to save on the cost of another blank DVD. You create 32-bit OS installation media complete with 32-bit software installations, (if you're happy to do this very frequently), then replicate the process with the 64-bit OS and 64-bit software. (Even Microsoft provide a separate disk for each). People need to be mindful not to fall into the trap of spending more time creating and updating media than the time saved by using it! <Edit /> I also notice that not once has the OP thanked any single contributor to this Topic for the pertinent responses they provided. -
Create .bat file to run after windows install
Yzöwl replied to ewilliams's topic in Unattended Windows 7/Server 2008R2
Well you are free of course to do that, however I'd suggest that if you venture elsewhere for a solution you'd be advised to: Answer questions posed. which as yet you've failed to do here. Tell the truth! which you've admitted failing to do here. We are not going to provide you with every possible answer in the hope that one will suit you and your situation. It is your responsibility to provide sufficient information in order that we can tailor responses to suit, (otherwise we could just tell you to read the guides and forum since your solution is most definitely among them). -
I thought you'd died… Welcome back!
-
Create .bat file to run after windows install
Yzöwl replied to ewilliams's topic in Unattended Windows 7/Server 2008R2
Of course there's something wrong with that; my issue isn't with sending someone to your website, it's with forcing it on first installation using a specific browser. Also if your doing this at your workplace you're likely connecting through a wired network, not the customers network. (so you are effectively testing the functioning in an environment under which it will not be used). If you are installing it at the customers premises then it is unlikely to work since their, usually wireless, network has not yet been configured. The prudent thing to do if your happy to force stuff on your customer like this would be to have this run once when they receive the PC and have set it up to their liking, and use a URL which is not linked to a specific browser. On the issue of software installation I'm afraid I'll never agree with condoning this practice. It is rude to force a particular piece of software onto someone else's machine, you should at least give them an on screen choice, the same way Microsoft had to with browsers. That said, the entire thought process here needs looking at. If I install a 64-bit Operating System onto a PC I'll already know that this will in turn involve installing 64-bit software where available; I certainly wouldn't need a batch file to work that out for me. I see no real benefit in creating a single installation media which installs both 32 and 64-bit and which is only as up to date as the versions of software integrated. -
Create .bat file to run after windows install
Yzöwl replied to ewilliams's topic in Unattended Windows 7/Server 2008R2
All you are doing is forcing a specific web page with a specific browser, that really isn't an test of the effectiveness/stability of your installation onto their hardware. Apart from that, I'm not naive, If you were simply checking functionality on a one time only basis why have you set it as their start page too? Additionally, I see no reason to force flashplayer and MSE on every customer either, (if someone requires flash they will be given the opportunity to install it from most sites using it, and MSE is not everyone's choice, only yours, some may prefer a full security suite or free products from companies like BitDefender or AVIRA. BTW, if you wish to receive a response to your question, you'd be more likely to get your wish if you provided a reasonably detailed explanation on which method(s) of installation you are using with each specific Operating System. -
Create .bat file to run after windows install
Yzöwl replied to ewilliams's topic in Unattended Windows 7/Server 2008R2
Although you are likely installing 64-bit onto every unit with a 64-bit CPU, I would suggest that you check the 'bitness' of the Operating System not that of the Hardware. Using a 'batch file', (your request), you can probably do this with WMIC. The following three lines could replace the first five lines previously provided by jaclaz @ECHO OFF&SETLOCAL SET "Bits=32" WMIC OS GET OSARCHITECTURE|FIND "64">NUL&&SET "Bits=64" Off Topic, I think that you are very wrong opening someone's Internet Explorer browser without them having had the opportunity to configure or update/patch it first.