ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Create Folder, Give It Name: Current Date and Time

(1/4) > >>

nkormanik:
Searching the Internet I came across the following PowerShell script:

New Folder Date Time.ps1

$folderName = (Get-Date).tostring("yyyy-MM-dd hh-mm-ss")
New-Item -itemType Directory -Path . -Name $FolderName
Executin

IF this .ps1 file is in the current directory, and executed by PowerShell, an example of the result will be a new folder:

2018-10-17 07-28-52

Here is the challenge, however....

Create in the current folder (subdirectory) the above new folder, current date and time.  From the context menu.  And don't require that the executable script reside in the current folder -- executable script (or program??) should be in some other permanent location.

Seems odd that such does not already exist out there somewhere.

All thoughts, suggestions appreciated!

Nicholas Kormanik

4wd:
Double-click on the Create Date-Time Folder - Install.reg file and answer Yes to let it merge with the registry.

It'll create a menu item called Create Date-Time Folder in the context menu of folders only, ie. you need to right-click on a folder to use it.

Create Date-Time Folder - Install.reg

--- Code: Text ---Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Folder\shell\Create Date-Time Folder\command]@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -sta -ExecutionPolicy Bypass -NoProfile -Command \"New-Item -ItemType Directory -Path '%1' -Name ((Get-Date).tostring('yyyy-MM-dd hh-mm-ss'))\""
If you don't want the output window that opens you can add | Out-Null after the two close brackets, ie. )) | Out-Null \""


And to remove it, double-click on the other file and answer Yes to merge it.

Create Date-Time Folder - Remove.reg

--- Code: Text ---Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\Folder\shell\Create Date-Time Folder]

ADDENDUM: Added two more .reg files, these are to Install/Remove the context menu item for when you right-click on the background from within a folder, (ie. you don't need to right-click on a folder).

Windows Registry Editor Version 5.00


--- Code: Text ---[HKEY_CLASSES_ROOT\Directory\Background\shell\Create Date-Time Folder\command]@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -sta -ExecutionPolicy Bypass -NoProfile -Command \"New-Item -ItemType Directory -Path '%1' -Name ((Get-Date).tostring('yyyy-MM-dd hh-mm-ss'))\""

--- Code: Text ---Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\Directory\Background\shell\Create Date-Time Folder]
DONE: Create Folder, Give It Name: Current Date and Time

KodeZwerg:
@4wd cool job!

4wd:
It actually doesn't need the following parameters -sta -ExecutionPolicy Bypass -NoProfile but it won't do any harm to leave them.

I was just being lazy and didn't remove them when I modified another file  :)

nkormanik:
4wd, ya did it again.  Exactly what I was hoping for.

Perhaps other Windows users will find their way here, and download some great little tools to make life a little easier.

Thanks!

Navigation

[0] Message Index

[#] Next page

Go to full version