Jump to content

Recommended Posts

Posted

Hi community, i'm new here.

My name is John :)

I'd like to insert Macro in @ComSpec command.

I have a .bat file with this script example:

C:\Folder01\Start.exe -10 C:Folder02\End.exe

The .bat working.

I want to make a .exe with @WORKINGDIR and @ComSpec Command because i can't to write the exact directory for deploy to another my PC with a different folder position.

I try:

$var1 = @WorkingDir & '\Folder01\Start.exe' 
$var2 = '-10 ' 
$var3 = @WorkingDir & '\Folder02\End.exe'
RunWait( @ComSpec & " /c " & $var1&$var2&$var3 )

But not work. I have use Macro in other ways, but in this case i don't now how to do. I'm a beginner, sorry ;)

Thanks

Posted

I think what you are looking for is @ScriptDir. It contains the directory that the script resides in.

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Posted

The script is correct?

I have only sostitute the @workingdir with @scriptdir?

Thanks

It looks good from what I see, except you might want to do "$var1 & " " & $var2 & " " & $var3" so the variables have a space in between them for the command to work.

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Posted

There were definitely some spaces missing, also check the console for output.

$var1 = @WorkingDir & '\Folder01\Start.exe'
$var2 = '-10 '
$var3 = @WorkingDir & '\Folder02\End.exe'
$sCmd = @ComSpec & " /c " & $var1 & " " & $var2 & " " & $var3
ConsoleWrite($sCmd & @CRLF)
RunWait($sCmd)
Posted

i have resolved

I use msgbox for see "" and space.

When everyting was ok I don't use @comspec but simply runwait($cmd)

$cmd is equal to var1 / var2 / var3

Thanks for support

John

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
×
×
  • Create New...