DiskPart
create vdisk file="C:\vdisks\disk1.vhd" maximum=16000
attach vdisk
create partition primary
assign letter=g
format
===========
can xy scripts ask me to choose these colored values?
create vhd disk file
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: create vhd disk file
input() is your friend.
One of my scripts helped you out? Please donate via Paypal
-
yusef88
- Posts: 1148
- Joined: 28 Jan 2013 03:50
- Location: Windows 8.1 32-bit
Re: create vhd disk file
thanks but how?
i can use it for one variable..what about multi variables
i can use it for one variable..what about multi variables
Code: Select all
$a = input("ShutDown Timer", "1h=3600);run "cmd /k ""Shutdown -r -f -t $a&exit"""-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: create vhd disk file
By using a divider if you want to use only one input for all three values.
E.g.:
Untested but it should work.
Ofc you have to start it from an elevated XY (or use a vbscript that autoelevates it)...
E.g.:
Code: Select all
$delim = "|";
$vhdScriptName = "%temp%\~vhdScript.txt";
$values = input("Input values...", "The delimiter is: " . $delim . "<crlf>1.) .vhd file name<crlf>2.) maximum<crlf>3. drive letter", "C:\vdisks\disk1.vhd|16000|g", , , 600, 200);
$vhdFile = gettoken($values, 1, $delim);
$vhdFolder = getpathcomponent($vhdFile, "path");
$maximum = gettoken($values, 2, $delim);
$driveLetter = gettoken($values, 3, $delim);
if (exists($vhdFolder) == 0) { new($vhdFolder, "dir"); }
$vhdScriptContent = <<<>>>
create vdisk file="$vhdFile" maximum=$maximum
attach vdisk
create partition primary
assign letter=$driveLetter
format
>>>;
writefile($vhdScriptName, $vhdScriptContent);
run """DISKPART"" /s ""$vhdScriptName""", , 2, 1;
delete 0, 0, $vhdScriptName;Ofc you have to start it from an elevated XY (or use a vbscript that autoelevates it)...
One of my scripts helped you out? Please donate via Paypal
-
yusef88
- Posts: 1148
- Joined: 28 Jan 2013 03:50
- Location: Windows 8.1 32-bit
Re: create vhd disk file
i didn't test it yet...many thanks Mr highend
-
yusef88
- Posts: 1148
- Joined: 28 Jan 2013 03:50
- Location: Windows 8.1 32-bit
Re: create vhd disk file
doesn't work, it create a bat file in temp folder but no cmd window pops up, even running it manually does nothing
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: create vhd disk file
?
You aren't using my script (it doesn't create a .bat file at all, only a .txt one)...
You aren't using my script (it doesn't create a .bat file at all, only a .txt one)...
One of my scripts helped you out? Please donate via Paypal
-
yusef88
- Posts: 1148
- Joined: 28 Jan 2013 03:50
- Location: Windows 8.1 32-bit
Re: create vhd disk file
OK i tested the script again, doesn't work for me
To see the attached files, you need to log into the forum.
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: create vhd disk file
It works for me...
1. You executed it from an ELEVATED XY instance?
2. The folder of the .vhd file was created?
What happens when you execute
diskpart /s <path to a .txt file, that contains the content of $vhdScriptContent (with resolved variable names)>
from a command prompt?
1. You executed it from an ELEVATED XY instance?
2. The folder of the .vhd file was created?
What happens when you execute
diskpart /s <path to a .txt file, that contains the content of $vhdScriptContent (with resolved variable names)>
from a command prompt?
One of my scripts helped you out? Please donate via Paypal
-
yusef88
- Posts: 1148
- Joined: 28 Jan 2013 03:50
- Location: Windows 8.1 32-bit
Re: create vhd disk file
highend
very sorry i did some mistakes>>> works fine now..many thanks.
XYplorer Beta Club