Jump to content

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


Go to solution Solved by Hawkysoft,

Recommended Posts

Posted

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.

 

 
Posted

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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Posted

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.

 

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...