我想尝试创建标题为日期和当前时间的目录.我知道我可以使用php time()函数,但这对我来说很难阅读.为什么我不能创建名为06-11-2014 11:37:04左右的目录?当我尝试使用这种格式时,php mkdir函数给了我一个无效的参数.
PHP代码
<?php
$newdate = date("m-d-Y H:i:s");
mkdir($newdate, 0755, true);
?>
Run Code Online (Sandbox Code Playgroud) //code for foo (run executable as ./a.out)
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/wait.h>
int main (int argc, char **argv) {
pid_t pid;
pid = fork();
int i = 1;
char *parms[] = {"test2", "5", NULL}; //test executable named test2
if(pid < 0) {
fprintf(stderr, "Fork failed");
return 1;
}
else if(pid == 0) {
printf("Child pid is %d\n", pid);
i = execv("test2", parms); //exec call to test with a param of 5
}
else {
wait(NULL); …Run Code Online (Sandbox Code Playgroud) 我正在以这种格式从XML文件中读取一个字符串.DD:HH:MM:SS.该字符串告诉我测试运行的持续时间.我想尝试获得一个月内所有测试需要多长时间的总和,但我不确定是否有办法将字符串转换为此格式的时间戳.我知道使用Convert.ToDateTime,但不幸的是我将永远不会在正在读入的字符串中有一个月或一年.我不完全确定这是否可能,但无论如何都要做这样的事情在C#,如果没有,还有其他任何建议吗?所有的帮助将不胜感激,谢谢!
var test = "00.00.00.14";
var final = Convert.ToDateTime("dd:hh:mm:ss"); //Any way to do something like this? This format throws an error
Run Code Online (Sandbox Code Playgroud) 我正在运行一个PowerShell脚本来将背景更改为某组颜色.我想这样做而不重新启动,但遗憾的是无法让更改立即在Windows 7/8平台上生效.我在网上找到了很多解决方案,但我找不到适合我的解决方案.我认为它可能与设置SystemParametersInfo有关,但我不确定.我已经看到了一些解决方案,并为自己尝试了,但我也无法让它们工作.注册表项更新只是找到,但更改只有在我重新启动后才会生效.以下是我到目前为止,如果有人看到任何我可以做的不同,我会很感激帮助!
backgroundtest.ps1
Add-Type @"
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace Background
{
public class Setter {
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern int SystemParametersInfo(int uAction, int uParm, string lpvParam, int fuWinIni);
public const int UpdateIniFile = 0x01;
public const int SendWinIniChange = 0x02;
public const int SetDesktopBackground = 20; <# following examples online to set parameters #>
public static void SetBackground() {
SystemParametersInfo(SetDesktopBackground, 0, "", UpdateIniFile | SendWinIniChange);
RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true); …Run Code Online (Sandbox Code Playgroud)