I dont know a way in batch then, and have never seen the properties exposed under vbscript filesystemobject etc (though could have missed them I suppose) Your options I imagine are third party tool, command line or otherwise or powershell then. With the latter if it was installed you can call it from batch etc. Easily enough -basically run powershell.exe pointed at the ps* file. Anyway sorry afaik answer is can't without a pc at hand to delve deeper.
You can run scripts with the command-line-based script host by typing the following at the command prompt: cscript [script name] [host options] [script arguments]. Where: script name is the name of the script file, including the file name extension and any necessary path information. Download Display Driver For Hcl Me Laptop on this page. Host options are the command-line. Cmd.exe, Microsoft® Windows® Operating System, Windows Command Processor, Microsoft Corporation, Run as Administrator with Command Prompt, Low. CScript.exe, Microsoft R Windows Script Host, Microsoft R Console Based Script Host, Microsoft Corporation, Open with Command Prompt, Medium.
I do have this gui util you can drag files onto to reset dtaes which i use to mod jpg files from their camera time picture was taken before renaming them by date in batch. But cant rememer off hand whether it only works for jpgs. Will check in couple of hours when at home. Condenser Design Calculation Pdf Reader.
Right, can confirm that this works from VBScript. I was always under the impression it couldn't be done! Sub Touch(FolderPath, FileName, NewDate) Set app = CreateObject('Shell.Applic ation') Set folder = app.NameSpace(FolderPath) Set file = folder.ParseName(FileName) file.ModifyDate = NewDate set file = nothing set folder = nothing set app = nothing End Sub Call Touch('C: 4.
WIP EE', 'copyit.cmd', '2012-01-01') So. Is VBScript an option. Are you happy for it to be supplied to you as a VBScript you can call with cscript //nologo 'dir' 'filename.txt' 'date' or do you want it to do it for all files in a dir etc. OK here you go with a VBScript. Save this as touch.vbs (or whatever you feel like).
You can then do: This to set mod. Time to dd/mm/yyyy 0:00: touch.vbs 'C: somedir' 'somefilename.txt' 'dd/mm/yyyy' or this to set mod. Time to dd/mm/yyyy hh:mm:ss touch.vbs 'C: somedir' 'somefilename.txt' 'dd/mm/yyyy hh:mm:ss' or this to set it to the time and date now. Touch.vbs 'C: somedir' 'somefilename.txt' We could mod. This to do multiple files if needed, or you can call it from batch file, e.g.
@echo off for /f 'delims='%%A in ('dir /b /a-d 'c: somedir *.pdf') do cscript //nologo 'C: somedir' '%%~A' '1/1/2011' to find all the files call *.pdf in c: somedir and run 'touch' over them with the date of 1/1/2011 Steve REM Command in VBScript to touch files with current date, or supplied date: Dim Dirname,Filename,TheDate If Wscript.Arguments.Count. Did you try the exe's to download, or the vbscript / batch file given above. If you did want to have it just in batch you could have it create the VBS for you, a bit trimmed down of some of it's baggage of error checking. And added some more of it in the batch file itself: You just need the two subroutines under the REM at the bottom and then the line: call:touch 'c: 4. WIP EE' 'log.txt' '1/11/2011 12:43' The rest is just showing it working.
Steve @echo off REM Command in VBScript to touch files with current date, or supplied date: REM Stephen Knight. REM EE question 27441352 CLS call:CreateTouchVBS echo Before: dir 'c: 4.
WIP EE log.txt' find ':' echo. Call:touch 'c: 4. WIP EE' 'log.txt' '1/11/2011 12:43' echo. Echo After: dir 'c: 4. Folks, I decides on Steve's solution from (my code attached) It seems the simplest. Public Sub Touch(FolderPath As String, FileName As String, NewDate As String) Const ThisProcName As String = 'Touch' Call Stacker(conModuleNum, ThisProcName) If Not (DefErrHandling Or SSM) Then On Error GoTo UnexpectedError 'This proc changes the File Modification Date of Filename in folder Folder to NewDate. 'It is similar to the Touch command in Unix.
'USEAGE: Call Touch('C: ', 'somefile.txt', '2012-01-01') 'NOTES: Shell does not have a file.CreateDate property.
I am a beginner in VBScript. I googled it & got to know that we can run VBScript from command line by executing below command: For Example my vbscript name is Converter.vbs & it's present in folder D: VBS. I can run it through following methods: CScript 'D: VBS Converter.vbs' OR WScript 'D: VBS Converter.vbs' Now I would like to execute above VBScript without Cscript or Wscript command by simply typing the name of VBscript name i.e. I DON'T WANT TO SPECIFY THE FULL PATH OF VBSCRIPT EVERYTIME. Can anyone please guide me on how to do that? Add your script to AppPaths in the registry.
You MUST register as if it's an exe file if you don't want to type the.vbs. So Add HKEY_LOCAL_MACHINE SOFTWARE Microsoft Windows CurrentVersion App Paths Converter.exe and set it's default value to cscript //nologo 'C: Users David Candy Documents Assorted Scripts converter.vbs' or use Doskey and autorun it to load your macros. Add an reg_sz autorun value to HKEY_CURRENT_USER Software Microsoft Command Processor of doskey /macrofile=c: mydoskeymacros.txt – Apr 15 '14 at 20:08. When entering the script's full file spec or its filename on the command line, the shell will use information accessibly by assoc grep -i vbs.vbs=VBSFile ftype grep -i vbs VBSFile=%SystemRoot% System32 CScript.exe '%1'%* to decide which program to run for the script. In my case it's cscript.exe, in yours it will be wscript.exe - that explains why your WScript.Echos result in MsgBoxes.
As cscript /? I'll break this down in to several distinct parts, as each part can be done individually. (I see the similar answer, but I'm going to give a more detailed explanation here.) First part, in order to avoid typing 'CScript' (or 'WScript'), you need to tell Windows how to launch a *.vbs script file. In My Windows 8 (I cannot be sure all these commands work exactly as shown here in older Windows, but the process is the same, even if you have to change the commands slightly), launch a console window (aka 'command prompt', or aka [incorrectly] 'dos prompt') and type ' assoc.vbs'.
That should result in a response such as: C: Windows System32>assoc.vbs.vbs=VBSFile Using that, you then type ' ftype VBSFile', which should result in a response of: C: Windows System32>ftype VBSFile vbsfile='%SystemRoot% System32 WScript.exe' '%1'%* -OR- C: Windows System32>ftype VBSFile vbsfile='%SystemRoot% System32 CScript.exe' '%1'%* If these two are already defined as above, your Windows' is already set up to know how to launch a *.vbs file. (BTW, WScript and CScript are the same program, using different names.
WScript launches the script as if it were a GUI program, and CScript launches it as if it were a command line program. Why don't you just stash the vbscript in a batch/vbscript file hybrid. Name the batch hybrid Converter.bat and you can execute it directly as Converter from the cmd line. Sure you can default ALL scripts to run from Cscript or Wscript, but if you want to execute your vbs as a windows script rather than a console script, this could cause some confusion later on. So just set your code to a batch file and run it directly. Check the answer ->And here is an example: Converter.bat::' VBS/Batch Hybrid::' --- Batch portion --------- rem^ &@echo off rem^ &call:'sub rem^ &exit /b:'sub rem^ &echo begin batch rem^ &cscript //nologo //e:vbscript '%~f0' rem^ &echo end batch rem^ &exit /b '----- VBS portion ----- Dim tester tester = 'Convert data here' Msgbox tester.