Sign in to follow this  
Followers 0
Draygoes

@ComSpec help... Cannot figure out how to include a variable in the line.

4 posts in this topic

Hello all.

I am trying to automate creating large test files. The code will pretty much tell you what I am trying to accomplish.

$Number = "1"
$SizeType = "MB"
If $SizeType = "MB" Then
    $Size = "1048576" * $Number
EndIf
If $SizeType = "GB" Then
    $Size = "1073741824" * $Number
EndIf
Run(@ComSpec & " /c " & 'fsutil file create new c:\users\steve\desktop\1gb.test'  & $Size & "'" , "", @SW_HIDE)

All I need is for the variable "$Size" to be inserted at the end of the command. This is proving harder than I thought.


Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

not at home atm but u should try this...

Run(@ComSpec & " /c fsutil file createnew test.txt " & $Size,"",@SW_HIDE)
Edited by Hawkysoft
1 person likes this

Share this post


Link to post
Share on other sites

I would try to change create new to createnew (no space)
and will add a space right after "desktop1gb.test ' <- add a space here after test

1 person likes this

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Thanks guys! The code above works, and thanks to PincoPanco for your explination.


Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0